mirror of
https://github.com/zyedidia/micro
synced 2024-10-04 15:09:41 +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
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue