mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2026-01-07 19:52:40 +01:00
Охуенная фича автоиндентации при нажатии на Enter. Хули я раньше ее не запилил, а? Репортед
This commit is contained in:
parent
106ff26cf2
commit
848da7d67b
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user