summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-05-16 19:45:12 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-05-16 19:45:12 +0200
commit17f3687e282d2e1756a3b15dbea9ddc781e9da53 (patch)
tree3621cec1e7789a83f4733467448f44a23ac5dc64
parent357323b8fc23030f0b602a32c52fd1e0e1860ea3 (diff)
downloadweechat-17f3687e282d2e1756a3b15dbea9ddc781e9da53.zip
core: fix partial completion when the common prefix found is empty (closes #340)
-rw-r--r--ChangeLog.adoc1
-rw-r--r--src/gui/gui-input.c8
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index b4fb5cc83..2bd995307 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -55,6 +55,7 @@ New features::
Bug fixes::
* core: fix completion after newline in input (issue #1925)
+ * core: fix partial completion when the common prefix found is empty (issue #340)
* core: display a specific error when trying to bind a key without area in mouse context
* core: fix display of key with command `/key bindctxt <context> <key>`
* core: fix default value of bar options (issue #846)
diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c
index 38be95fdf..bbe27dd30 100644
--- a/src/gui/gui-input.c
+++ b/src/gui/gui-input.c
@@ -416,6 +416,14 @@ gui_input_complete (struct t_gui_buffer *buffer)
if (!buffer->completion || !buffer->completion->word_found)
return;
+ /*
+ * in case the word found is empty, we keep the word in input as-is
+ * (this can happen with partial completion when the common prefix found
+ * is empty)
+ */
+ if (!buffer->completion->word_found[0])
+ return;
+
/* replace word with new completed word into input buffer */
if (buffer->completion->diff_size > 0)
{