Add a user option to allow delete and backspace to delete immediately even if the character to be deleted is visually distant from the caret location. Bug 328834, r=uriber@gmail.com, sr=roc

This commit is contained in:
smontagu%smontagu.org 2006-03-07 06:03:37 +00:00
parent 210588e5e5
commit 68fd2fbdfe
4 changed files with 17 additions and 1 deletions

View File

@ -165,6 +165,14 @@ nsTextEditRules::Init(nsPlaintextEditor *aEditor, PRUint32 aFlags)
res = ReplaceNewlines(wholeDoc);
}
PRBool deleteBidiImmediately = PR_FALSE;
nsCOMPtr<nsIPrefBranch> prefBranch =
do_GetService(NS_PREFSERVICE_CONTRACTID, &res);
if (NS_SUCCEEDED(res))
prefBranch->GetBoolPref("bidi.edit.delete_immediately",
&deleteBidiImmediately);
mDeleteBidiImmediately = deleteBidiImmediately;
return res;
}

View File

@ -211,6 +211,10 @@ protected:
PRUint32 mActionNesting;
PRPackedBool mLockRulesSniffing;
PRPackedBool mDidExplicitlySetInterline;
PRPackedBool mDeleteBidiImmediately; // in bidirectional text, delete
// characters not visually
// adjacent to the caret without
// moving the caret first.
PRInt32 mTheAction; // the top level editor action
// friends
friend class nsAutoLockRulesSniffing;

View File

@ -143,7 +143,7 @@ nsTextEditRules::CheckBidiLevelForDeletion(nsIDOMNode *aSelNode,
; // perform the deletion
else
{
if (levelBefore == levelAfter)
if (mDeleteBidiImmediately || levelBefore == levelAfter)
; // perform the deletion
else
*aCancel = PR_TRUE;

View File

@ -927,6 +927,10 @@ pref("bidi.support", 1);
// 1 = doccharactersetBidi *
// 2 = defaultcharactersetBidi
pref("bidi.characterset", 1);
// Whether delete and backspace should immediately delete characters not
// visually adjacent to the caret, or adjust the visual position of the caret
// on the first keypress and delete the character on a second keypress
pref("bidi.edit.delete_immediately", false);
// used for double-click word selection behavior. Win will override.