diff options
| author | Stephen Blott | 2015-06-04 16:23:54 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-06-04 16:24:39 +0100 |
| commit | 2473475367411fdeb051a6752d0059e337ad09e3 (patch) | |
| tree | abdee23357ea7d30b30e19c32420d7717387bd08 | |
| parent | 9600d258cbadd80568e37637974172e7755ca28c (diff) | |
| download | vimium-2473475367411fdeb051a6752d0059e337ad09e3.tar.bz2 | |
Use only ' and ` for jumping to previous position.
As suggested by @mrmr1993 in #1716.
| -rw-r--r-- | content_scripts/marks.coffee | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/content_scripts/marks.coffee b/content_scripts/marks.coffee index fc30849a..5bb35f1f 100644 --- a/content_scripts/marks.coffee +++ b/content_scripts/marks.coffee @@ -1,7 +1,8 @@ Marks = + previousPositionRegisters: [ "`", "'" ] + localRegisters: {} mode: null - previousPosition: null exit: (continuation = null) -> @mode?.exit() @@ -16,7 +17,8 @@ Marks = JSON.stringify scrollX: window.scrollX, scrollY: window.scrollY setPreviousPosition: -> - @previousPosition = @getMarkString() + markString = @getMarkString() + @localRegisters[reg] = markString for reg in @previousPositionRegisters showMessage: (message, keyChar) -> HUD.showForDuration "#{message} \"#{keyChar}\".", 1000 @@ -45,11 +47,6 @@ Marks = @showMessage "Created local mark", keyChar activateGotoMode: (registryEntry) -> - # We pick off the last character of the key sequence used to launch this command. Usually this is just "`". - # We then use that character, so together usually the sequence "``", to jump back to the previous - # position. The "previous position" is recorded below, and is registered via @setPreviousPosition() - # elsewhere for various other jump-like commands. - previousPositionKey = registryEntry.key[registryEntry.key.length-1..] @mode = new Mode name: "goto-mark" indicator: "Go to mark..." @@ -63,8 +60,7 @@ Marks = handler: 'gotoMark' markName: keyChar else - markString = - if keyChar == previousPositionKey then @previousPosition else localStorage[@getLocationKey keyChar] + markString = @localRegisters[keyChar] ? localStorage[@getLocationKey keyChar] if markString? @setPreviousPosition() position = JSON.parse markString |
