diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-01-10 18:54:21 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-01-10 18:54:21 +0100 |
commit | 97ee65fcb87325bd7fa0bbe3d1487e6a3fda5f65 (patch) | |
tree | e29565233baf2cd119ff975d35683eafec4ee578 /src | |
parent | cb96bf4280c5b3e8f7e6142b900e70af46c85cc7 (diff) | |
download | poezio-97ee65fcb87325bd7fa0bbe3d1487e6a3fda5f65.tar.gz poezio-97ee65fcb87325bd7fa0bbe3d1487e6a3fda5f65.tar.bz2 poezio-97ee65fcb87325bd7fa0bbe3d1487e6a3fda5f65.tar.xz poezio-97ee65fcb87325bd7fa0bbe3d1487e6a3fda5f65.zip |
use fast search by default (s), and possibly use slow search (S)
Diffstat (limited to 'src')
-rw-r--r-- | src/core.py | 1 | ||||
-rw-r--r-- | src/tabs.py | 23 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/core.py b/src/core.py index 1a022a79..f9a1f419 100644 --- a/src/core.py +++ b/src/core.py @@ -691,6 +691,7 @@ class Core(object): Reset terminal capabilities to what they were before ncurses init """ + curses.curs_set(1) curses.echo() curses.nocbreak() curses.endwin() diff --git a/src/tabs.py b/src/tabs.py index f04ef504..1cec7b28 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -755,7 +755,8 @@ class RosterInfoTab(Tab): self.key_func["KEY_UP"] = self.move_cursor_up self.key_func["KEY_DOWN"] = self.move_cursor_down self.key_func["o"] = self.toggle_offline_show - self.key_func["^F"] = self.start_search + self.key_func["s"] = self.start_search + self.key_func["S"] = self.start_search_slow self.resize() def resize(self): @@ -886,6 +887,17 @@ class RosterInfoTab(Tab): self.input.resize(1, self.width, self.height-1, 0, self.core.stdscr) return True + def start_search_slow(self): + curses.curs_set(1) + self.input = windows.CommandInput("[Search]", self.on_search_terminate, self.on_search_terminate, self.set_roster_filter_slow) + self.input.resize(1, self.width, self.height-1, 0, self.core.stdscr) + return True + + def set_roster_filter_slow(self, txt): + roster._contact_filter = (jid_and_name_match_slow, txt) + self.roster_win.refresh(roster) + return False + def set_roster_filter(self, txt): roster._contact_filter = (jid_and_name_match, txt) self.roster_win.refresh(roster) @@ -1200,6 +1212,15 @@ def diffmatch(search, string): def jid_and_name_match(contact, txt): """ + """ + if not txt: + return True + if txt in JID(contact.get_bare_jid()).user: + return True + return False + +def jid_and_name_match_slow(contact, txt): + """ A function used to know if a contact in the roster should be shown in the roster """ |