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:
Zachary Yedidia
2017-06-15 18:52:51 -04:00
parent 00718f99cf
commit 21840d3ffe
6 changed files with 58 additions and 23 deletions

View File

@@ -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