diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-11-01 02:34:53 +0000 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-11-01 02:36:30 +0000 |
commit | 0556f85870ff5f19164ee6db17db5277f7b647d4 (patch) | |
tree | 232ce9767c12614593d6821031b4f272b4d9b29d | |
parent | c88ab021732fcb86dab1af717295236e7e792acb (diff) | |
download | poezio-0556f85870ff5f19164ee6db17db5277f7b647d4.tar.gz poezio-0556f85870ff5f19164ee6db17db5277f7b647d4.tar.bz2 poezio-0556f85870ff5f19164ee6db17db5277f7b647d4.tar.xz poezio-0556f85870ff5f19164ee6db17db5277f7b647d4.zip |
Optimise /win a bit, and make sure we always keep the previous tab.
-rw-r--r-- | poezio/core/commands.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/poezio/core/commands.py b/poezio/core/commands.py index c4fb6353..838e08fa 100644 --- a/poezio/core/commands.py +++ b/poezio/core/commands.py @@ -197,6 +197,7 @@ class CommandCore: number = int(name) except ValueError: number = -1 + name = name.lower() if number != -1 and self.core.current_tab_nb == number: return prev_nb = self.core.previous_tab_nb @@ -211,9 +212,10 @@ class CommandCore: matchs = [] for tab in self.core.tabs: for tab_name in tab.matching_names(): - if tab_name[1] and name.lower() in tab_name[1].lower(): + if tab_name[1] and name in tab_name[1].lower(): matchs.append((tab_name[0], tab)) if not matchs: + self.core.previous_tab_nb = prev_nb return tab = min(matchs, key=lambda m: m[0])[1] self.core.current_tab_nb = tab.nb |