From 26d3461f466ec320bb051cdb6f61ddf1e699bddc Mon Sep 17 00:00:00 2001 From: Anthony Ryan Date: Sat, 14 Nov 2015 23:20:50 -0500 Subject: [PATCH] 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. --- src/fe-gtk/fkeys.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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;