mirror of
https://github.com/zyedidia/micro
synced 2024-10-06 16:09:22 +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:
parent
104caf08dd
commit
c52ccad14b
|
@ -50,11 +50,11 @@ function preInsertNewline(bp)
|
||||||
for i = 1, #autoNewlinePairs do
|
for i = 1, #autoNewlinePairs do
|
||||||
if curRune == charAt(autoNewlinePairs[i], 1) then
|
if curRune == charAt(autoNewlinePairs[i], 1) then
|
||||||
if nextRune == charAt(autoNewlinePairs[i], 2) then
|
if nextRune == charAt(autoNewlinePairs[i], 2) then
|
||||||
bp:InsertNewline()
|
|
||||||
bp:InsertTab()
|
|
||||||
bp.Buf:Insert(-bp.Cursor.Loc, "\n" .. ws)
|
bp.Buf:Insert(-bp.Cursor.Loc, "\n" .. ws)
|
||||||
bp:StartOfLine()
|
bp:StartOfLine()
|
||||||
bp:CursorLeft()
|
bp:CursorLeft()
|
||||||
|
bp:InsertNewline()
|
||||||
|
bp:InsertTab()
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue