Bug 157546 - "[CTL-Thai] IM: <delete> key should delete WHOLE Thai "display cell"" [p=thep@linux.thai.net (Theppitak Karoonboonyanan) r+sr=roc a1.9=beltzner]

This commit is contained in:
reed%reedloden.com 2008-02-15 05:30:35 +00:00
Родитель c02d84268f
Коммит 02e9e7d405
6 изменённых файлов: 40 добавлений и 1 удалений

Просмотреть файл

@ -51,7 +51,7 @@ interface nsIDOMNode;
interface nsISelection; interface nsISelection;
interface nsISelectionDisplay; interface nsISelectionDisplay;
[scriptable, uuid(39429306-4c81-4d8b-9421-eb7d9f43bfd0)] [scriptable, uuid(80d2e85a-4ad2-45be-88e7-8c1fe943ac4d)]
interface nsISelectionController : nsISelectionDisplay interface nsISelectionController : nsISelectionDisplay
{ {
const short SELECTION_NONE=0; const short SELECTION_NONE=0;
@ -154,6 +154,12 @@ interface nsISelectionController : nsISelectionDisplay
*/ */
void characterMove(in boolean forward, in boolean extend); void characterMove(in boolean forward, in boolean extend);
/** CharacterExtendForDelete will extend the selection one character cell
* forward in the document.
* this method is used internally for handling del key.
*/
[noscript] void characterExtendForDelete();
/** WordMove will move the selection one word forward/backward in the document. /** WordMove will move the selection one word forward/backward in the document.
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
* the "point" of selection that is extended is considered the "focus" point. * the "point" of selection that is extended is considered the "focus" point.

Просмотреть файл

@ -662,6 +662,7 @@ NS_IMETHODIMP nsPlaintextEditor::DeleteSelection(nsIEditor::EDirection aAction)
if (NS_FAILED(result)) return result; if (NS_FAILED(result)) return result;
if (!bCollapsed && if (!bCollapsed &&
(aAction == eNextWord || aAction == ePreviousWord || (aAction == eNextWord || aAction == ePreviousWord ||
aAction == eNext ||
aAction == eToBeginningOfLine || aAction == eToEndOfLine)) aAction == eToBeginningOfLine || aAction == eToEndOfLine))
if (mCaretStyle == 1) if (mCaretStyle == 1)
{ {
@ -678,6 +679,7 @@ NS_IMETHODIMP nsPlaintextEditor::DeleteSelection(nsIEditor::EDirection aAction)
// This needs to happen inside selection batching, // This needs to happen inside selection batching,
// otherwise the deleted text is autocopied to the clipboard. // otherwise the deleted text is autocopied to the clipboard.
if (aAction == eNextWord || aAction == ePreviousWord if (aAction == eNextWord || aAction == ePreviousWord
|| aAction == eNext
|| aAction == eToBeginningOfLine || aAction == eToEndOfLine) || aAction == eToBeginningOfLine || aAction == eToEndOfLine)
{ {
nsCOMPtr<nsISelectionController> selCont (do_QueryReferent(mSelConWeak)); nsCOMPtr<nsISelectionController> selCont (do_QueryReferent(mSelConWeak));
@ -696,6 +698,10 @@ NS_IMETHODIMP nsPlaintextEditor::DeleteSelection(nsIEditor::EDirection aAction)
result = selCont->WordExtendForDelete(PR_FALSE); result = selCont->WordExtendForDelete(PR_FALSE);
aAction = eNone; aAction = eNone;
break; break;
case eNext:
result = selCont->CharacterExtendForDelete();
aAction = eNone;
break;
case eToBeginningOfLine: case eToBeginningOfLine:
selCont->IntraLineMove(PR_TRUE, PR_FALSE); // try to move to end selCont->IntraLineMove(PR_TRUE, PR_FALSE); // try to move to end
result = selCont->IntraLineMove(PR_FALSE, PR_TRUE); // select to beginning result = selCont->IntraLineMove(PR_FALSE, PR_TRUE); // select to beginning

Просмотреть файл

@ -927,6 +927,7 @@ public:
// nsISelectionController // nsISelectionController
NS_IMETHOD CharacterMove(PRBool aForward, PRBool aExtend); NS_IMETHOD CharacterMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD CharacterExtendForDelete();
NS_IMETHOD WordMove(PRBool aForward, PRBool aExtend); NS_IMETHOD WordMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD WordExtendForDelete(PRBool aForward); NS_IMETHOD WordExtendForDelete(PRBool aForward);
NS_IMETHOD LineMove(PRBool aForward, PRBool aExtend); NS_IMETHOD LineMove(PRBool aForward, PRBool aExtend);
@ -2716,6 +2717,12 @@ PresShell::CharacterMove(PRBool aForward, PRBool aExtend)
return mSelection->CharacterMove(aForward, aExtend); return mSelection->CharacterMove(aForward, aExtend);
} }
NS_IMETHODIMP
PresShell::CharacterExtendForDelete()
{
return mSelection->CharacterExtendForDelete();
}
NS_IMETHODIMP NS_IMETHODIMP
PresShell::WordMove(PRBool aForward, PRBool aExtend) PresShell::WordMove(PRBool aForward, PRBool aExtend)
{ {

Просмотреть файл

@ -581,6 +581,7 @@ public:
NS_IMETHOD GetCaretEnabled(PRBool *_retval); NS_IMETHOD GetCaretEnabled(PRBool *_retval);
NS_IMETHOD SetCaretVisibilityDuringSelection(PRBool aVisibility); NS_IMETHOD SetCaretVisibilityDuringSelection(PRBool aVisibility);
NS_IMETHOD CharacterMove(PRBool aForward, PRBool aExtend); NS_IMETHOD CharacterMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD CharacterExtendForDelete();
NS_IMETHOD WordMove(PRBool aForward, PRBool aExtend); NS_IMETHOD WordMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD WordExtendForDelete(PRBool aForward); NS_IMETHOD WordExtendForDelete(PRBool aForward);
NS_IMETHOD LineMove(PRBool aForward, PRBool aExtend); NS_IMETHOD LineMove(PRBool aForward, PRBool aExtend);
@ -794,6 +795,13 @@ nsTextInputSelectionImpl::CharacterMove(PRBool aForward, PRBool aExtend)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
} }
NS_IMETHODIMP
nsTextInputSelectionImpl::CharacterExtendForDelete()
{
if (mFrameSelection)
return mFrameSelection->CharacterExtendForDelete();
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP NS_IMETHODIMP
nsTextInputSelectionImpl::WordMove(PRBool aForward, PRBool aExtend) nsTextInputSelectionImpl::WordMove(PRBool aForward, PRBool aExtend)

Просмотреть файл

@ -409,6 +409,12 @@ public:
/*unsafe*/ /*unsafe*/
nsresult CharacterMove(PRBool aForward, PRBool aExtend); nsresult CharacterMove(PRBool aForward, PRBool aExtend);
/** CharacterExtendForDelete extends the selection forward (logically) to
* the next character cell, so that the selected cell can be deleted.
*/
/*unsafe*/
nsresult CharacterExtendForDelete();
/** WordMove will generally be called from the nsiselectioncontroller implementations. /** WordMove will generally be called from the nsiselectioncontroller implementations.
* the effect being the selection will move one word left or right. * the effect being the selection will move one word left or right.
* @param aForward move forward in document. * @param aForward move forward in document.

Просмотреть файл

@ -2772,6 +2772,12 @@ nsFrameSelection::CharacterMove(PRBool aForward, PRBool aExtend)
return MoveCaret(nsIDOMKeyEvent::DOM_VK_LEFT,aExtend,eSelectCharacter); return MoveCaret(nsIDOMKeyEvent::DOM_VK_LEFT,aExtend,eSelectCharacter);
} }
nsresult
nsFrameSelection::CharacterExtendForDelete()
{
return MoveCaret(nsIDOMKeyEvent::DOM_VK_DELETE, PR_TRUE, eSelectCharacter);
}
nsresult nsresult
nsFrameSelection::WordMove(PRBool aForward, PRBool aExtend) nsFrameSelection::WordMove(PRBool aForward, PRBool aExtend)
{ {