Tab completion: Case insensitive, handle spaces

This commit is contained in:
fiaxh 2018-01-05 18:25:25 +01:00
parent a8cc94c188
commit 2e041e2984
2 changed files with 7 additions and 5 deletions

View file

@ -67,9 +67,9 @@ class OccupantsTabCompletor {
string prev_completion = text.substring(start_index); string prev_completion = text.substring(start_index);
if (index > -1) { if (index > -1) {
start_index = int.max( 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") text.substring(0, text.length - 1).last_index_of("\n")
) + 1; );
prev_completion = text.substring(start_index); prev_completion = text.substring(start_index);
} }
if (backwards) { 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); Gee.List<Jid>? occupants = stream_interactor.get_module(MucManager.IDENTITY).get_other_occupants(conversation.counterpart, conversation.account);
if (occupants != null) { if (occupants != null) {
foreach (Jid jid in occupants) { 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(); ret.sort();

View file

@ -59,7 +59,7 @@ public class XmppStream {
if (best_provider != null) { if (best_provider != null) {
stream = yield best_provider.connect(this); 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)); stream = yield (new SocketClient()).connect_async(new NetworkService("xmpp-client", "tcp", this.remote_name));
} }
if (stream == null) { if (stream == null) {