From 0029863f32be7cb079c43faeb9df84b0718f147d Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Fri, 30 Jan 2015 09:08:26 +0000 Subject: Visual/edit modes: better find-mode integration. --- content_scripts/mode_visual_edit.coffee | 7 +++++-- content_scripts/vimium_frontend.coffee | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/mode_visual_edit.coffee b/content_scripts/mode_visual_edit.coffee index f14baff7..842f6c0a 100644 --- a/content_scripts/mode_visual_edit.coffee +++ b/content_scripts/mode_visual_edit.coffee @@ -266,7 +266,7 @@ class Movement extends CountPrefix @continueBubbling - # Install basic bindings for find mode, "n" and "N". We do not install these bindings if the is a + # Install basic bindings for find mode, "n" and "N". We do not install these bindings if this is a # sub-mode of edit mode, because we cannot (yet) guarantee that the selection will remain within the # active element. unless @options.parentMode or options.oneMovementOnly @@ -283,7 +283,9 @@ class Movement extends CountPrefix @movements.n = (count) -> executeFind count, false @movements.N = (count) -> executeFind count, true - @movements["/"] = -> enterFindMode() + @movements["/"] = -> + @findMode = enterFindMode() + @findMode.onExit => new VisualMode # # End of Movement constructor. @@ -361,6 +363,7 @@ class VisualMode extends Movement switch @selection.type when "None" + HUD.showForDuration "No selection, entering caret mode first.", 2500 return @changeMode CaretMode when "Caret" @selection.modify "extend", forward, character unless @options.oneMovementOnly diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index b71d1b18..6b96e929 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -1021,6 +1021,7 @@ findModeRestoreSelection = (range = findModeInitialRange) -> selection.removeAllRanges() selection.addRange range +# Enters find mode. Returns the new find-mode instance. window.enterFindMode = -> # Save the selection, so performFindInPlace can restore it. findModeSaveSelection() -- cgit v1.2.3