From fdedbaa45a8b400bc01cdc7f541463eca188676a Mon Sep 17 00:00:00 2001 From: Igor Timofeev Date: Fri, 22 Jun 2018 00:21:23 +0300 Subject: [PATCH] Return button fix --- Applications/MineCodeIDE/Main.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Applications/MineCodeIDE/Main.lua b/Applications/MineCodeIDE/Main.lua index 30cf7307..2e7178a5 100755 --- a/Applications/MineCodeIDE/Main.lua +++ b/Applications/MineCodeIDE/Main.lua @@ -1467,6 +1467,10 @@ codeView.eventHandler = function(mainContainer, object, e1, e2, e3, e4, e5) -- Enter elseif e4 == 28 then if autocomplete.hidden then + if codeView.selections[1] then + deleteSelectedData() + end + local secondPart = unicode.sub(lines[cursorPositionLine], cursorPositionSymbol, -1) local match = lines[cursorPositionLine]:match("^(%s+)") @@ -1477,7 +1481,7 @@ codeView.eventHandler = function(mainContainer, object, e1, e2, e3, e4, e5) lines[cursorPositionLine] = unicode.sub(lines[cursorPositionLine], 1, cursorPositionSymbol - 1) table.insert(lines, cursorPositionLine + 1, secondPart) - setCursorPositionAndClearSelection(unicode.len(secondPart) + 1, cursorPositionLine + 1) + setCursorPositionAndClearSelection(match and #match + 1 or 1, cursorPositionLine + 1) else autocomplete.hidden = true end