// Insert creates an insert text event and executes it
func (eh *EventHandler) Insert(start int, text string) {
e := &TextEvent{
- c: eh.v.cursor,
+ c: eh.v.Cursor,
eventType: TextEventInsert,
text: text,
start: start,
// Remove creates a remove text event and executes it
func (eh *EventHandler) Remove(start, end int) {
e := &TextEvent{
- c: eh.v.cursor,
+ c: eh.v.Cursor,
eventType: TextEventRemove,
start: start,
end: end,
eh.redo = new(Stack)
}
eh.undo.Push(t)
- ExecuteTextEvent(t, eh.v.buf)
+ ExecuteTextEvent(t, eh.v.Buf)
}
// Undo the first event in the undo stack
te := t.(*TextEvent)
// Undo it
// Modifies the text event
- UndoTextEvent(te, eh.v.buf)
+ UndoTextEvent(te, eh.v.Buf)
// Set the cursor in the right place
teCursor := te.c
- te.c = eh.v.cursor
- eh.v.cursor = teCursor
+ te.c = eh.v.Cursor
+ eh.v.Cursor = teCursor
// Push it to the redo stack
eh.redo.Push(te)
te := t.(*TextEvent)
// Modifies the text event
- UndoTextEvent(te, eh.v.buf)
+ UndoTextEvent(te, eh.v.Buf)
teCursor := te.c
- te.c = eh.v.cursor
- eh.v.cursor = teCursor
+ te.c = eh.v.Cursor
+ eh.v.Cursor = teCursor
eh.undo.Push(te)
}