Commit eab4615f authored by Jonas Schäfer's avatar Jonas Schäfer
Browse files

Add /wup command

The `/wup` command selects a tab by the prefix of its name only.

The `/win` will do a substring match based on the first tab
going from the current tab which matches the substring. This can
be confusing, especially since `/win` matches on different types
of tab "names" not only on the name which is shown in the info bar
by default.

The `/wup` command exclusively matches based on the prefix of the string. This has the advantage that it is consistent,
deterministic and independent of the currently selected tab.
parent c1863add
......@@ -93,6 +93,15 @@ These commands work in *any* tab.
Go to the matching tab. If the argument is a number, it goes to the tab with that number.
Otherwise, it goes to the next tab whose name contains the given string.
**Usage:** ``/wup <prefix>``
Go to the tab whose name starts with `prefix`. If multiple tabs start
with that prefix, no action is taken.
(Mnemonic: Window by Unique Prefix)
**Usage:** ``/status <availability> [status message]``
......@@ -219,6 +219,20 @@ class CommandCore:
def wup(self, args):
/wup <prefix of name>
if args is None:
prefix = args[0]
_, match = self.core.tabs.find_by_unique_prefix(prefix)
if match is None:
def move_tab(self, args):
......@@ -1709,6 +1709,12 @@ class Core:
usage='<number or name>',
shortdesc='Go to the specified room',
shortdesc='Go to the tab whose name uniquely starts with prefix',
self.commands['w'] = self.commands['win']
......@@ -29,6 +29,7 @@ from collections import defaultdict
from slixmpp import JID
from poezio import tabs
from import EventHandler
from poezio.config import config
class Tabs:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment