From 130a9677c7c14e93dfbddd12fd54c41d605bbc5b Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Tue, 9 Aug 2011 18:57:30 -0400 Subject: Autocomplete supports multiple selections. Contributed by Brian Schott. --- modules/textadept/adeptsense.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'modules/textadept/adeptsense.lua') 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 -- cgit v1.2.3