aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2018-01-05 18:25:25 +0100
committerfiaxh <git@mx.ax.lt>2018-01-06 14:02:32 +0100
commit2e041e2984fa303034a9736918631935c52ac03a (patch)
tree2730ce6599bbfcf47e45a58b5907cf25b9613ab4
parenta8cc94c188c085e8788e072017ef21d7b7812a55 (diff)
downloaddino-2e041e2984fa303034a9736918631935c52ac03a.tar.gz
dino-2e041e2984fa303034a9736918631935c52ac03a.zip
Tab completion: Case insensitive, handle spaces
-rw-r--r--main/src/ui/chat_input/occupants_tab_completer.vala10
-rw-r--r--xmpp-vala/src/core/xmpp_stream.vala2
2 files changed, 7 insertions, 5 deletions
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<Jid>? 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
+}
diff --git a/xmpp-vala/src/core/xmpp_stream.vala b/xmpp-vala/src/core/xmpp_stream.vala
index 6d4b9c64..6c364e80 100644
--- a/xmpp-vala/src/core/xmpp_stream.vala
+++ b/xmpp-vala/src/core/xmpp_stream.vala
@@ -59,7 +59,7 @@ public class XmppStream {
if (best_provider != null) {
stream = yield best_provider.connect(this);
}
- if (stream != null) {
+ if (stream == null) {
stream = yield (new SocketClient()).connect_async(new NetworkService("xmpp-client", "tcp", this.remote_name));
}
if (stream == null) {