Summary: | Eliminate Editor::deleteRange() | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Alexey Proskuryakov <ap> | ||||
Component: | HTML Editing | Assignee: | Alexey Proskuryakov <ap> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | ||||||
Priority: | P3 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | Mac | ||||||
OS: | OS X 10.4 | ||||||
Attachments: |
|
Description
Alexey Proskuryakov
2007-11-13 06:58:43 PST
Created attachment 17226 [details]
proposed patch
I did notice that SelectionController was used improperly in one place here, but adding the needed functionality to Selection seemed too involved for this patch.
> - It tries to unify too many different operations - as a result, it has to
> re-select what is already selected etc. Makes data flow hard to follow.
Also, complicates fixing bugs that require deleting a range that's smaller than selection.
Comment on attachment 17226 [details]
proposed patch
+ void yank();
+ void yankAndSelect();
+ void setMark();
+ void deleteToMark();
+ void selectToMark();
+ void swapWithMark();
I was hoping that at some point these would be added to platforms other that Macintosh. The mark ones, for example, don't rely on anything Macintosh-specific -- they just happen to be unused on other platforms at the moment. But people might later want to add key bindings for them, since they mimic emacs.
The yank ones simply rely on the existence of a kill ring, something that we could create a small platform-independent abstraction for, so the kill ring itself would be platform-specific, but the operations could be platform independent.
+ if (Frame* coreFrame = core([self _frame]))
+ coreFrame->editor()->swapWithMark();
A better way to handle these would be to add "SwapWithMark" to the named commands that Editor handles by adding it to the CommandMap. Then swapWithMark: could be added to the list of commands using the WEBCORE_COMMAND macro instead of having hand-written code to forward to a particular named command.
r=me, as-is, but I think this could be made even better
> A better way to handle these would be to add "SwapWithMark" to the named
> commands that Editor handles by adding it to the CommandMap.
Ah, that would definitely be better - I didn't understand the architecture well enough. I'll keep that in mind when working on editing next time.
Committed revision 27873.
|