aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-07-23 18:42:21 +0200
committerPřemysl Eric Janouch <p@janouch.name>2021-07-23 18:43:20 +0200
commit3cb93d24e8ced647a0af656e10919d45cd6eef25 (patch)
tree9446880f97eb1acb8feb7aedd1fa11271a2f2a0b
parentacddfe2cfab3692f21824d1345479b9c88367e30 (diff)
downloadxK-3cb93d24e8ced647a0af656e10919d45cd6eef25.tar.gz
xK-3cb93d24e8ced647a0af656e10919d45cd6eef25.tar.xz
xK-3cb93d24e8ced647a0af656e10919d45cd6eef25.zip
degesch: order nick autocomplete by time
-rw-r--r--NEWS5
-rw-r--r--degesch.c17
2 files changed, 22 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 1c94e79..c5bc35a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+1.3.0 (20xx-xx-xx)
+
+ * degesch: made nick autocompletion ordered by the time of last action
+
+
1.2.0 (2021-07-08) "There Are Other Countries As Well"
* degesch: added a /squery command for IRCnet
diff --git a/degesch.c b/degesch.c
index 846d08f..76b8b16 100644
--- a/degesch.c
+++ b/degesch.c
@@ -459,6 +459,10 @@ input_rl_start (void *input, const char *program_name)
rl_completer_word_break_characters = NULL;
rl_attempted_completion_function = app_readline_completion;
+ // We shouldn't produce any duplicates that the library would help us
+ // autofilter, and we don't generally want alphabetic ordering at all
+ rl_sort_completion_matches = false;
+
hard_assert (self->prompt != NULL);
// The inputrc is read before any callbacks are called, so we need to
// register all functions that our user may want to map up front
@@ -7266,6 +7270,19 @@ irc_handle_privmsg_text (struct server *s,
char *prefixes = irc_get_privmsg_prefix
(s, str_map_find (&s->irc_users, nickname), target);
+ // Make autocomplete offer the last speakers first on partial matches
+ // TODO: might want to do this on notices as well, and the behaviour
+ // shouldn't change depending on whether CAP echo-message is enabled
+ struct user *user;
+ struct channel_user *channel_user;
+ if (buffer->channel
+ && (user = str_map_find (&s->irc_users, nickname))
+ && (channel_user = irc_channel_get_user (buffer->channel, user)))
+ {
+ LIST_UNLINK (buffer->channel->users, channel_user);
+ LIST_PREPEND (buffer->channel->users, channel_user);
+ }
+
// IRCv3.2 echo-message could otherwise cause us to highlight ourselves
if (irc_is_this_us (s, msg->prefix) || !irc_is_highlight (s, text->str))
{