diff options
| author | Stephen Blott | 2015-02-05 12:57:24 +0000 |
|---|---|---|
| committer | Stephen Blott | 2015-02-05 13:54:19 +0000 |
| commit | 0ca75980d714f2863ad8f46eb69ccc17e917ede6 (patch) | |
| tree | f95d6c8c39c9ecba06272b2f6d359b5edae3c223 | |
| parent | 49a0f357e4c8b110993200a4340d9c36e9749333 (diff) | |
| download | vimium-0ca75980d714f2863ad8f46eb69ccc17e917ede6.tar.bz2 | |
Visual/edit modes: visualmode-escape clears selection.
This effectively reverts 95e086563b918364d3038f6489cc97c73fcb7180
(Escape-Escape clears selection) pending discussion of the right UX
around exitng visual mode.
| -rw-r--r-- | content_scripts/mode_visual_edit.coffee | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/content_scripts/mode_visual_edit.coffee b/content_scripts/mode_visual_edit.coffee index 8f4459ee..c62fae87 100644 --- a/content_scripts/mode_visual_edit.coffee +++ b/content_scripts/mode_visual_edit.coffee @@ -383,21 +383,24 @@ class Movement extends CountPrefix exit: (event, target) -> unless @options.parentMode or @options.oneMovementOnly - # If we're exiting on escape and there is a range selection, then we leave it in place. However, an - # immediately-following Escape clears the selection. See #1441. - if @selection.type == "Range" and event?.type == "keydown" and KeyboardUtils.isEscape event - handlerStack.push - _name: "visual/range/escape" - click: -> handlerStack.remove(); @continueBubbling - focus: -> handlerStack.remove(); @continueBubbling - keydown: (event) => - handlerStack.remove() - if @selection.type == "Range" and event.type == "keydown" and KeyboardUtils.isEscape event - @collapseSelectionToFocus() - DomUtils.suppressKeyupAfterEscape handlerStack - @suppressEvent - else - @continueBubbling + @selection.removeAllRanges() if event?.type == "keydown" and KeyboardUtils.isEscape event + + # Disabled, pending discussion of fine-tuning the UX. Simpler alternative is implemented above. + # # If we're exiting on escape and there is a range selection, then we leave it in place. However, an + # # immediately-following Escape clears the selection. See #1441. + # if @selection.type == "Range" and event?.type == "keydown" and KeyboardUtils.isEscape event + # handlerStack.push + # _name: "visual/range/escape" + # click: -> handlerStack.remove(); @continueBubbling + # focus: -> handlerStack.remove(); @continueBubbling + # keydown: (event) => + # handlerStack.remove() + # if @selection.type == "Range" and event.type == "keydown" and KeyboardUtils.isEscape event + # @collapseSelectionToFocus() + # DomUtils.suppressKeyupAfterEscape handlerStack + # @suppressEvent + # else + # @continueBubbling super event, target |
