Closed
Bug 350564
Opened 19 years ago
Closed 19 years ago
Non-standard behaviour on word deletion when a non-collapsed selection exists
Categories
(Core :: DOM: Editor, defect)
Core
DOM: Editor
Tracking
()
RESOLVED
FIXED
People
(Reporter: smontagu, Assigned: smontagu)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
|
5.31 KB,
patch
|
glazou
:
review+
neil
:
superreview+
|
Details | Diff | Splinter Review |
When deleting by word, with ctrl-delete or ctrl-backspace, and there is already an active non-collapsed selection, what should happen?
The standard behaviour varies by platform. On Windows the existing selection is collapsed to start, and then the deletion is performed. On Mac and Linux, the existing selection is deleted (in other words the behaviour is identical for delete, backspace, ctrl-delete and ctrl-backspace).
In Gecko, the existing selection is extended by word boundaries in the direction of the deletion (forwards for delete and backwards for backspace, and then the resulting selection is deleted.
A table may make this clearer. Assume an input field containing "one two three four five" in which "two three four" is selected.
Resulting text in a native Windows rich text control:
After ctrl-delete: one three four five
After ctrl-backspace: two three four five
Resulting text in Gecko:
Selecting forwards Selecting backwards
After ctrl-delete: one one two five
After ctrl-backspace one four five five
| Assignee | ||
Comment 1•19 years ago
|
||
At Uri's suggestion, I made the behaviour depend on the existing layout.selection.caret_style pref from bug 299417.
| Assignee | ||
Updated•19 years ago
|
Attachment #236073 -
Flags: review?(daniel)
Attachment #236073 -
Flags: review?(daniel) → review+
| Assignee | ||
Updated•19 years ago
|
Attachment #236073 -
Flags: superreview?(neil)
Comment 3•19 years ago
|
||
Comment on attachment 236073 [details] [diff] [review]
Patch
>+ prefBranch->GetIntPref("layout.selection.caret_style", &mCaretStyle);
>+#ifdef XP_WIN
>+ if (mCaretStyle == 0)
>+ mCaretStyle = 1;
>+#endif
Not your fault, but why do we bother having ifdefs in all.js i.e.
#ifdef XP_WIN
pref("layout.selection.caret_style", 1);
#else
#ifdef XP_MACOSX
pref("layout.selection.caret_style", 2);
#else
pref("layout.selection.caret_style", 0);
#endif
#endif
As it is, you've subtly changed the meaning of the preference, and you should update the comment to indicate that the pref affects word delete and if you want to achieve the Unix behaviour (Ctrl+Bksp deletes any selection, but the caret is visible) then you need to set the pref to 3. sr=me with that fixed.
>+ (aAction == eNextWord || aAction == ePreviousWord ||
>+ aAction == eToBeginningOfLine || aAction == eToEndOfLine))
Nit: doubled space
>+ if (mCaretStyle == 1)
>+ {
>+ result = selection->CollapseToStart();
>+ if (NS_FAILED(result)) return result;
>+ }
>+ else
>+ aAction = eNone;
Other code (SplitNodeImpl) seems to like to have lots more {}s.
Attachment #236073 -
Flags: superreview?(neil) → superreview+
| Assignee | ||
Updated•19 years ago
|
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•