diff options
| author | Stephen Blott | 2015-09-17 06:55:41 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2015-09-17 06:55:41 +0100 | 
| commit | b2ddd07b9f5c0db014b7283b910ffcfc64219850 (patch) | |
| tree | aea54feedced86f60ba0b3fc0f64c5d4373fcf6e | |
| parent | 00f7fcdb2dedcaef34c498c862c403b28fdf9c88 (diff) | |
| parent | 38b24c8a09f2d56d833172fcb7e67ac320117b41 (diff) | |
| download | vimium-b2ddd07b9f5c0db014b7283b910ffcfc64219850.tar.bz2 | |
Merge pull request #1828 from smblott-github/add-count-for-g0-and-g$
Add <count> prefix for g0 and g$.
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | background_scripts/commands.coffee | 4 | ||||
| -rw-r--r-- | background_scripts/main.coffee | 14 | 
3 files changed, 9 insertions, 10 deletions
| @@ -155,6 +155,7 @@ Release Notes  -------------  Updates since 1.52 (not yet released) +- `g0` and `g$` now accept count prefixes; so `2g0` selects the second tab, and so on.  - Bug fixes:      - Fix `moveTabLeft` and `moveTabRight` for pinned tabs (#1814 and #1815). diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index 64ec36be..a0b17ebc 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -309,8 +309,8 @@ commandDescriptions =    # Manipulating tabs    nextTab: ["Go one tab right", { background: true, passCountToFunction: true }]    previousTab: ["Go one tab left", { background: true, passCountToFunction: true }] -  firstTab: ["Go to the first tab", { background: true }] -  lastTab: ["Go to the last tab", { background: true }] +  firstTab: ["Go to the first tab", { background: true, passCountToFunction: true }] +  lastTab: ["Go to the last tab", { background: true, passCountToFunction: true }]    createTab: ["Create new tab", { background: true, repeatLimit: 20 }]    duplicateTab: ["Duplicate current tab", { background: true, repeatLimit: 20 }] diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 1a49c3cb..511d24ac 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -267,8 +267,8 @@ BackgroundCommands =        chrome.windows.create {tabId: tab.id, incognito: tab.incognito}    nextTab: (count) -> selectTab "next", count    previousTab: (count) -> selectTab "previous", count -  firstTab: -> selectTab "first" -  lastTab: -> selectTab "last" +  firstTab: (count) -> selectTab "first", count +  lastTab: (count) -> selectTab "last", count    removeTab: (callback) ->      chrome.tabs.getSelected(null, (tab) ->        chrome.tabs.remove(tab.id) @@ -349,15 +349,13 @@ selectTab = (direction, count = 1) ->        toSelect =          switch direction            when "next" -            currentTab.index + count +            Math.min tabs.length - 1, currentTab.index + count            when "previous" -            currentTab.index - count +            Math.max 0, currentTab.index - count            when "first" -            0 +            Math.min tabs.length - 1, count - 1            when "last" -            tabs.length - 1 -      # Bring toSelect into the range [0,tabs.length). -      toSelect = (toSelect + tabs.length * Math.abs count) % tabs.length +            Math.max 0, tabs.length - count        chrome.tabs.update tabs[toSelect].id, selected: true  updateOpenTabs = (tab, deleteFrames = false) -> | 
