From 2e041e2984fa303034a9736918631935c52ac03a Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 5 Jan 2018 18:25:25 +0100 Subject: Tab completion: Case insensitive, handle spaces --- main/src/ui/chat_input/occupants_tab_completer.vala | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'main') diff --git a/main/src/ui/chat_input/occupants_tab_completer.vala b/main/src/ui/chat_input/occupants_tab_completer.vala index 4d5d2904..2f35bf0d 100644 --- a/main/src/ui/chat_input/occupants_tab_completer.vala +++ b/main/src/ui/chat_input/occupants_tab_completer.vala @@ -67,9 +67,9 @@ class OccupantsTabCompletor { string prev_completion = text.substring(start_index); if (index > -1) { start_index = int.max( - text.substring(0, text.length - 1).last_index_of(" "), + text.last_index_of(completions[index]), text.substring(0, text.length - 1).last_index_of("\n") - ) + 1; + ); prev_completion = text.substring(start_index); } if (backwards) { @@ -103,7 +103,9 @@ class OccupantsTabCompletor { Gee.List? occupants = stream_interactor.get_module(MucManager.IDENTITY).get_other_occupants(conversation.counterpart, conversation.account); if (occupants != null) { foreach (Jid jid in occupants) { - if (jid.resourcepart.to_string().has_prefix(prefix)) ret.add(jid.resourcepart.to_string()); + if (jid.resourcepart.to_string().down().has_prefix(prefix.down())) { + ret.add(jid.resourcepart.to_string()); + } } } ret.sort(); @@ -111,4 +113,4 @@ class OccupantsTabCompletor { } } -} \ No newline at end of file +} -- cgit v1.2.3-70-g09d2