summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorAnthony Ryan <anthonyryan1@gmail.com>2015-11-14 23:20:50 -0500
committerAnthony Ryan <anthonyryan1@gmail.com>2015-11-14 23:22:57 -0500
commit26d3461f466ec320bb051cdb6f61ddf1e699bddc (patch)
tree08528e193e6c9527e44dca3370dddf512b806b00 /src
parent295061f4619ff75aedad8b758e439ff1f21b5e47 (diff)
Make tab completion prefer other people
If you are talking with someone else with the same prefix as your
own nickname, and attempt to tab complete theirs. It will complete
your own nickname before theirs if you talked more recently. Since
people rarely intend to highlight themselves, this improves the
logic to complete your own name only as a last resort.
Diffstat (limited to 'src')
-rw-r--r--src/fe-gtk/fkeys.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/fe-gtk/fkeys.c b/src/fe-gtk/fkeys.c
index e762d208..af0e149a 100644
--- a/src/fe-gtk/fkeys.c
+++ b/src/fe-gtk/fkeys.c
@@ -1409,10 +1409,21 @@ key_action_tab_clean(void)
 	}
 }
 
-/* For use in sorting the user list for completion */
+/* For use in sorting the user list for completion
+
+This sorts everyone by the last talked time except your own nick
+which is forced to the bottom of the list to avoid completing your
+own name, which is very unlikely.
+*/
 static int
 talked_recent_cmp (struct User *a, struct User *b)
 {
+	if (a->me)
+		return -1;
+
+	if (b->me)
+		return 1;
+
 	if (a->lasttalk < b->lasttalk)
 		return -1;