aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/mode_visual_edit.coffee
diff options
context:
space:
mode:
authormrmr19932015-06-10 16:47:47 +0100
committermrmr19932015-06-10 20:59:17 +0100
commitcef0526a2c2ef3a99a88b1c52d0c027e7e5cd0b9 (patch)
tree7bde694017793bc2ef924c6b940aef4053bef052 /content_scripts/mode_visual_edit.coffee
parentf7cd2560ffa40d046065d351bc73481c51b9388e (diff)
downloadvimium-cef0526a2c2ef3a99a88b1c52d0c027e7e5cd0b9.tar.bz2
Make find from visual mode behave the same as a normal find
Diffstat (limited to 'content_scripts/mode_visual_edit.coffee')
-rw-r--r--content_scripts/mode_visual_edit.coffee27
1 files changed, 13 insertions, 14 deletions
diff --git a/content_scripts/mode_visual_edit.coffee b/content_scripts/mode_visual_edit.coffee
index 1be5def2..a62b2738 100644
--- a/content_scripts/mode_visual_edit.coffee
+++ b/content_scripts/mode_visual_edit.coffee
@@ -351,20 +351,19 @@ class Movement extends CountPrefix
# element), or if this instance has been created to execute only a single movement.
unless @options.parentMode or options.oneMovementOnly
do =>
- executeFind = (count, findBackwards) =>
- if query = FindMode.getQuery findBackwards
- initialRange = @selection.getRangeAt(0).cloneRange()
- for [0...count]
- unless window.find query, Utils.hasUpperCase(query), findBackwards, true, false, true, false
- @setSelectionRange initialRange
- HUD.showForDuration("No matches for '#{findModeQuery.rawQuery}'", 1000)
- return
- # The find was successfull. If we're in caret mode, then we should now have a selection, so we can
- # drop back into visual mode.
- @changeMode VisualMode if @name == "caret" and 0 < @selection.toString().length
-
- @movements.n = (count) -> executeFind count, false
- @movements.N = (count) -> executeFind count, true
+ doFind = (count, backwards) =>
+ initialRange = @selection.getRangeAt(0).cloneRange()
+ for [0...count] by 1
+ unless executeFind null, {colorSelection: false, backwards}
+ @setSelectionRange initialRange
+ HUD.showForDuration("No matches for '#{findModeQuery.rawQuery}'", 1000)
+ return
+ # The find was successfull. If we're in caret mode, then we should now have a selection, so we can
+ # drop back into visual mode.
+ @changeMode VisualMode if @name == "caret" and 0 < @selection.toString().length
+
+ @movements.n = (count) -> doFind count, false
+ @movements.N = (count) -> doFind count, true
@movements["/"] = ->
@findMode = new FindMode returnToViewport: true
@findMode.onExit => @changeMode VisualMode