On Tue, Aug 17, 2010 at 8:22 PM, Sam Hartsfield <[email protected]> wrote:

> Looks like the question is what you expected... I don't think I ever
> use them when there is a selection.

Thanks for the research you did.  For selections, compatibility with
other editors is not important, imo.

Selections are nasty to handle.  A case could be made for any of the
following behaviors:

- Delete just the selection.
- Delete all words covered by any part of the selection.
  However, edge cases here are tricky.
- Delete the word at the forward edge of the selection for delete-word,
  and back edge of the selection for backward-delete-word.
- Delete the word at the *back* edge of the selection for delete-word,
  and the *forward* edge of the selection for backward-deleted-word.

One can easily discover counter-intuitive operation for any of these cases.

This is kinda nasty to code as well.  For ease of *coding* I picked
the "delete selection" options:

    if w.hasSelection():
        from_pos,to_pos = w.getSelectionRange()
    else:
        from_pos = w.getInsertPoint()
        c.editCommands.moveWordHelper(None,extend=False,forward=forward)
        to_pos = w.getInsertPoint()

Now the unit tests for the "selection" cases pass :-)

The new code and unit tests are on the trunk at rev 3266.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to