aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2011-09-28 19:41:01 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2011-09-28 19:41:01 -0400
commit0b479113adf05af7cea116f4519bb5d65d05aac7 (patch)
tree2ee506178b5089237d8125191a4197592f46a831
parent543ee48ef8361c22863cd0f34ee3ff15bfbd1268 (diff)
downloadtextadept-0b479113adf05af7cea116f4519bb5d65d05aac7.tar.gz
textadept-0b479113adf05af7cea116f4519bb5d65d05aac7.zip
Fixed bug with autocomplete and capitalizations; modules/textadept/editing.lua
Thanks to Brian Schott.
-rw-r--r--modules/textadept/editing.lua5
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 06427795..401a72e0 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -142,10 +142,9 @@ end)
events.connect(events.AUTO_C_SELECTION, function(text, position)
local buffer = buffer
local caret = buffer.selection_n_caret[buffer.main_selection]
- if position ~= caret then text = text:sub(caret - position + 1) end
buffer:begin_undo_action()
for i = 0, buffer.selections - 1 do
- buffer.target_start = buffer.selection_n_anchor[i]
+ buffer.target_start = buffer.selection_n_anchor[i] - (caret - position)
buffer.target_end = buffer.selection_n_caret[i]
buffer:replace_target(text)
buffer.selection_n_anchor[i] = buffer.selection_n_anchor[i] + #text
@@ -215,7 +214,7 @@ function autocomplete_word(word_chars)
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, c_list[1]:sub(#root + 1), caret)
+ events.emit(events.AUTO_C_SELECTION, c_list[1], caret - #root)
end
return true
end