mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-17 06:17:12 +09:00
Make cursor movement automatic on insert + remove
This changes the behavior of cursor movement so that all cursors are adjusted when a change is made to the buffer. Cursors don't have to be manually moved after calling Insert or Remove, those functions will move the cursor properly on their own. This should fix issues 1-3 mentioned in the multiple cursors discussion. Ref #5
This commit is contained in:
@@ -1085,6 +1085,7 @@ function onRune(r, v)
|
||||
-- when converting go structs to lua
|
||||
-- It needs to be dereferenced because the function expects a non pointer struct
|
||||
v.Buf:Insert(-v.Cursor.Loc, charAt(autoclosePairs[i], 2))
|
||||
v:CursorLeft(false)
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -1107,6 +1108,7 @@ function preInsertNewline(v)
|
||||
v:InsertNewline(false)
|
||||
v:InsertTab(false)
|
||||
v.Buf:Insert(-v.Cursor.Loc, "\n" .. ws)
|
||||
v:CursorLeft(false)
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user