1
0
mirror of https://github.com/zyedidia/micro synced 2024-07-05 17:08:48 +00:00

hltrailingws: adjust autoclose plugin implementation

Fix unwanted highlighting of whitespace in the new line when inserting
a newline after a bracket (when hltrailingws is on). To fix it, change
the order of operations: insert the new empty line after all other
things, to avoid moving the cursor between lines after that.
This commit is contained in:
Dmitry Maluka 2020-10-20 23:46:55 +02:00 committed by Dmytro Maluka
parent 104caf08dd
commit c52ccad14b

View File

@ -50,11 +50,11 @@ function preInsertNewline(bp)
for i = 1, #autoNewlinePairs do
if curRune == charAt(autoNewlinePairs[i], 1) then
if nextRune == charAt(autoNewlinePairs[i], 2) then
bp:InsertNewline()
bp:InsertTab()
bp.Buf:Insert(-bp.Cursor.Loc, "\n" .. ws)
bp:StartOfLine()
bp:CursorLeft()
bp:InsertNewline()
bp:InsertTab()
return false
end
end