diff options
author | 2011-08-09 18:57:30 -0400 | |
---|---|---|
committer | 2011-08-09 18:57:30 -0400 | |
commit | 130a9677c7c14e93dfbddd12fd54c41d605bbc5b (patch) | |
tree | 8b31f09bd2be75e9f3d3a7b1ee87ffbd3a643c8d /modules/textadept/adeptsense.lua | |
parent | a8af7ff1d2141bdbbd6d670b23c34f993496a353 (diff) | |
download | textadept-130a9677c7c14e93dfbddd12fd54c41d605bbc5b.tar.gz textadept-130a9677c7c14e93dfbddd12fd54c41d605bbc5b.zip |
Autocomplete supports multiple selections.
Contributed by Brian Schott.
Diffstat (limited to 'modules/textadept/adeptsense.lua')
-rw-r--r-- | modules/textadept/adeptsense.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/textadept/adeptsense.lua b/modules/textadept/adeptsense.lua index aab1bd65..e414bd73 100644 --- a/modules/textadept/adeptsense.lua +++ b/modules/textadept/adeptsense.lua @@ -504,7 +504,14 @@ function complete(sense, only_fields, only_functions) buffer:clear_registered_images() buffer:register_image(1, FIELDS) buffer:register_image(2, FUNCTIONS) - buffer:auto_c_show(#part, table.concat(completions, ' ')) + if not buffer.auto_c_choose_single or #completions ~= 1 then + buffer:auto_c_show(#part, table.concat(completions, ' ')) + else + -- Scintilla does not emit AUTO_C_SELECTION in this case. This is necessary + -- for autocompletion with multiple selections. + events.emit(events.AUTO_C_SELECTION, completions[1]:sub(#part + 1), + buffer.current_pos) + end return true end |