summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-11-12 16:09:14 +0100
committerSebastien Helleu <flashcode@flashtux.org>2011-11-12 16:09:14 +0100
commitc7a1a01d8fdb65282cd6e68af095618be8ffcc5a (patch)
treecac5da84e1010b0c365ae51057b54ccf4b58e3f2 /src/gui
parentc8cf55c291fd0f1e48a386db34df2ea21aa3dbda (diff)
downloadweechat-c7a1a01d8fdb65282cd6e68af095618be8ffcc5a.zip
core: add new option weechat.completion.base_word_until_cursor: allow completion in middle of words (enabled by default) (task #9771)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui-completion.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c
index 06211172a..c789022ae 100644
--- a/src/gui/gui-completion.c
+++ b/src/gui/gui-completion.c
@@ -686,12 +686,21 @@ gui_completion_find_context (struct t_gui_completion *completion,
}
pos_start = i + 1;
}
- i = pos;
- while ((i < size) && (data[i] != ' '))
+ if (CONFIG_BOOLEAN (config_completion_base_word_until_cursor))
{
- i++;
+ /* base word stops at cursor */
+ pos_end = pos - 1;
+ }
+ else
+ {
+ /* base word stops after first space found (on or after cursor) */
+ i = pos;
+ while ((i < size) && (data[i] != ' '))
+ {
+ i++;
+ }
+ pos_end = i - 1;
}
- pos_end = i - 1;
if (completion->context == GUI_COMPLETION_COMMAND)
{