From 848da7d67b39f4a64778d02460261d0cab3d38ec Mon Sep 17 00:00:00 2001 From: Igor Timofeev Date: Fri, 27 Apr 2018 20:18:45 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=85=D1=83=D0=B5=D0=BD=D0=BD=D0=B0?= =?UTF-8?q?=D1=8F=20=D1=84=D0=B8=D1=87=D0=B0=20=D0=B0=D0=B2=D1=82=D0=BE?= =?UTF-8?q?=D0=B8=D0=BD=D0=B4=D0=B5=D0=BD=D1=82=D0=B0=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=20=D0=BD=D0=B0=D0=B6=D0=B0=D1=82=D0=B8=D0=B8?= =?UTF-8?q?=20=D0=BD=D0=B0=20Enter.=20=D0=A5=D1=83=D0=BB=D0=B8=20=D1=8F=20?= =?UTF-8?q?=D1=80=D0=B0=D0=BD=D1=8C=D1=88=D0=B5=20=D0=B5=D0=B5=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D0=B7=D0=B0=D0=BF=D0=B8=D0=BB=D0=B8=D0=BB,=20=D0=B0?= =?UTF-8?q?=3F=20=D0=A0=D0=B5=D0=BF=D0=BE=D1=80=D1=82=D0=B5=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Applications/MineCodeIDE/Main.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Applications/MineCodeIDE/Main.lua b/Applications/MineCodeIDE/Main.lua index ae054150..044035bc 100755 --- a/Applications/MineCodeIDE/Main.lua +++ b/Applications/MineCodeIDE/Main.lua @@ -1505,11 +1505,17 @@ codeView.eventHandler = function(mainContainer, object, eventData) -- Enter elseif eventData[4] == 28 then if autocomplete.hidden then - local firstPart = unicode.sub(codeView.lines[cursorPositionLine], 1, cursorPositionSymbol - 1) local secondPart = unicode.sub(codeView.lines[cursorPositionLine], cursorPositionSymbol, -1) - codeView.lines[cursorPositionLine] = firstPart + + local match = codeView.lines[cursorPositionLine]:match("^(%s+)") + if match then + secondPart = match .. secondPart + end + + codeView.lines[cursorPositionLine] = unicode.sub(codeView.lines[cursorPositionLine], 1, cursorPositionSymbol - 1) table.insert(codeView.lines, cursorPositionLine + 1, secondPart) - setCursorPositionAndClearSelection(1, cursorPositionLine + 1) + + setCursorPositionAndClearSelection(unicode.len(secondPart) + 1, cursorPositionLine + 1) else autocomplete.hidden = true end