diff options
-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 """ |