diff options
author | Kris Maglione <maglione.k@gmail.com> | 2011-02-08 17:08:23 -0500 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2011-02-08 17:08:23 -0500 |
commit | d32ca133643a8faeae356e0e4e343f385ae64eb7 (patch) | |
tree | 1a6653e540fa4c23ced59342cfeebf0b696fa819 /common/content/tabs.js | |
parent | 20615a402153a427b440422f29292010e978608a (diff) | |
download | pentadactyl-d32ca133643a8faeae356e0e4e343f385ae64eb7.tar.gz |
Fix gb and friends.
Diffstat (limited to 'common/content/tabs.js')
-rw-r--r-- | common/content/tabs.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/common/content/tabs.js b/common/content/tabs.js index e7754fe1..4053db0b 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -456,8 +456,8 @@ var Tabs = Module("tabs", { if (buffer == "#") return tabs.selectAlternateTab(); - count = Math.max(1, count || 1); reverse = Boolean(reverse); + count = Math.max(1, count || 1) * (1 + -2 * reverse); let matches = buffer.match(/^(\d+):?/); if (matches) @@ -467,17 +467,21 @@ var Tabs = Module("tabs", { if (matches) return tabs.select(matches, false); - matches = completion.runCompleter("buffer", buffer); + matches = completion.runCompleter("buffer", buffer).map(function (obj) obj.tab); if (matches.length == 0) dactyl.echoerr("E94: No matching buffer for " + buffer); else if (matches.length > 1 && !allowNonUnique) dactyl.echoerr("E93: More than one match for " + buffer); else { - let index = (count - 1) % matches.length; - if (reverse) - index = matches.length - index - 1; - tabs.select(matches[index].id, false); + let start = matches.indexOf(tabs.getTab()); + if (start == -1 && reverse) + start++; + + let index = (start + count) % matches.length; + if (index < 0) + index = matches.length + index; + tabs.select(matches[index], false); } }, |