diff options
| author | Stephen Blott | 2015-06-05 07:14:50 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2015-06-05 07:16:51 +0100 | 
| commit | 83fc0e58f6139ff5a1ae37fc300ea647da079171 (patch) | |
| tree | f03ee1bd3bd45d5c289322a2200f443843c19da9 | |
| parent | 8eda31fb236b9506d577a25908d4e5334d3289d5 (diff) | |
| download | vimium-83fc0e58f6139ff5a1ae37fc300ea647da079171.tar.bz2 | |
Global marks; always treat ` and ' as local marks.
On some keyboards (who knows?) "`" or "'" could be shift keys.  In this
case, with the previous implementation, these would be treated as global
marks and `` would be unusable.  This commit fixes that problem.
| -rw-r--r-- | content_scripts/marks.coffee | 13 | 
1 files changed, 8 insertions, 5 deletions
| diff --git a/content_scripts/marks.coffee b/content_scripts/marks.coffee index f569e1ea..067d05a8 100644 --- a/content_scripts/marks.coffee +++ b/content_scripts/marks.coffee @@ -23,6 +23,12 @@ Marks =    showMessage: (message, keyChar) ->      HUD.showForDuration "#{message} \"#{keyChar}\".", 1000 +  # If <Shift> is depressed, then it's a global mark, otherwise it's a local mark.  This is consistent +  # vim's [A-Z] for global marks and [a-z] for local marks.  However, it also admits other non-Latin +  # characters.  The exceptions are "`" and "'", which are always considered local marks. +  isGlobalMark: (event, keyChar) -> +    event.shiftKey and keyChar not in @previousPositionRegisters +    activateCreateMode: ->      @mode = new Mode        name: "create-mark" @@ -31,11 +37,8 @@ Marks =        suppressAllKeyboardEvents: true        keypress: (event) =>          keyChar = String.fromCharCode event.charCode -        # If <Shift> is depressed, then it's a global mark, otherwise it's a local mark.  This is consistent -        # vim's [A-Z] for global marks, [a-z] for local marks.  However, it also admits other non-Latin -        # characters.          @exit => -          if event.shiftKey +          if @isGlobalMark event, keyChar              # We record the current scroll position, but only if this is the top frame within the tab.              # Otherwise, we'll fetch the scroll position of the top frame from the background page later.              [ scrollX, scrollY ] = [ window.scrollX, window.scrollY ] if DomUtils.isTopFrame() @@ -58,7 +61,7 @@ Marks =        keypress: (event) =>          @exit =>            keyChar = String.fromCharCode event.charCode -          if event.shiftKey +          if @isGlobalMark event, keyChar              chrome.runtime.sendMessage                handler: 'gotoMark'                markName: keyChar | 
