Commit 68fd2fbd authored by smontagu%smontagu.org's avatar smontagu%smontagu.org
Browse files

Add a user option to allow delete and backspace to delete immediately even if...

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
parent 210588e5
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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;
}

+4 −0
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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;
+4 −0
Original line number Diff line number Diff line
@@ -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.