Example #1
0
func (c *GlueMarkedUndoGroupsCommand) Run(v *backend.View, e *backend.Edit) error {
	pos := v.UndoStack().Position()
	if mark, ok := v.Settings().Get(lime_cmd_mark).(int); ok {
		if l, p := pos-mark, mark; p != -1 && (l-p) > 1 {
			v.UndoStack().GlueFrom(mark)
		}
	} else {
		return fmt.Errorf("No mark in the current view")
	}
	return nil
}
Example #2
0
func (c *MaybeMarkUndoGroupsForGluingCommand) Run(v *backend.View, e *backend.Edit) error {
	if !v.Settings().Has(lime_cmd_mark) {
		v.Settings().Set(lime_cmd_mark, v.UndoStack().Position())
	}
	return nil
}
Example #3
0
func (c *UndoCommand) Run(v *backend.View, e *backend.Edit, args backend.Args) error {
	v.UndoStack().Undo(c.hard)
	return nil
}
Example #4
0
func (c *RedoCommand) Run(v *backend.View, e *backend.Edit) error {
	v.UndoStack().Redo(c.hard)
	return nil
}
Example #5
0
func (c *MarkUndoGroupsForGluingCommand) Run(v *backend.View, e *backend.Edit, args backend.Args) error {
	v.Settings().Set(lime_cmd_mark, v.UndoStack().Position())
	return nil
}