diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2019-06-02 22:51:57 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2019-06-02 23:09:58 +0200 |
commit | 2d825e1f2b98b206437bf1efd49e2dbcce8d31a5 (patch) | |
tree | 3cc27ab300f2365c3db6cea7bc919944ed454f82 | |
parent | 7e96a07ae505ae1c05ce7f474fefb091cc69001f (diff) | |
download | wee-slack-2d825e1f2b98b206437bf1efd49e2dbcce8d31a5.tar.gz |
Allow completion of emoji with a prefix
Fixes #580
-rw-r--r-- | wee_slack.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py index 25ccd61..85b3d37 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -973,8 +973,13 @@ def emoji_completion_cb(data, completion_item, current_buffer, completion): if current_channel is None: return w.WEECHAT_RC_OK + line_input = w.buffer_get_string(current_buffer, "input") + current_pos = w.buffer_get_integer(current_buffer, "input_pos") + current_word_match = re.search(r'[^: ]*:', line_input[:current_pos].split()[-1]) + prefix = current_word_match.group(0) if current_word_match else ':' + for emoji in current_channel.team.emoji_completions: - w.hook_completion_list_add(completion, ":" + emoji + ":", 0, w.WEECHAT_LIST_POS_SORT) + w.hook_completion_list_add(completion, prefix + emoji + ":", 0, w.WEECHAT_LIST_POS_SORT) return w.WEECHAT_RC_OK |