mirror of
https://github.com/felixangell/phi.git
synced 2024-09-11 15:55:25 +03:00
undo and redo of text, closes #53
This commit is contained in:
parent
ee055fdc67
commit
edbe684306
@ -2,10 +2,11 @@ package cfg
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/felixangell/strife"
|
||||
"log"
|
||||
"regexp"
|
||||
"strconv"
|
||||
|
||||
"github.com/felixangell/strife"
|
||||
)
|
||||
|
||||
type TomlConfig struct {
|
||||
|
@ -62,6 +62,12 @@ draw = true
|
||||
flash = true
|
||||
|
||||
[commands]
|
||||
[commands.undo]
|
||||
shortcut = "ctrl+z"
|
||||
|
||||
[commands.redo]
|
||||
shortcut = "ctrl+y"
|
||||
|
||||
[commands.save]
|
||||
shortcut = "ctrl+s"
|
||||
|
||||
|
@ -62,6 +62,12 @@ draw = true
|
||||
flash = true
|
||||
|
||||
[commands]
|
||||
[commands.undo]
|
||||
shortcut = "ctrl+z"
|
||||
|
||||
[commands.redo]
|
||||
shortcut = "ctrl+y"
|
||||
|
||||
[commands.exit]
|
||||
shortcut = "ctrl+q"
|
||||
|
||||
|
@ -62,6 +62,12 @@ draw = true
|
||||
flash = true
|
||||
|
||||
[commands]
|
||||
[commands.undo]
|
||||
shortcut = "super+z"
|
||||
|
||||
[commands.redo]
|
||||
shortcut = "super+y"
|
||||
|
||||
[commands.exit]
|
||||
shortcut = "super+q"
|
||||
|
||||
|
@ -126,6 +126,9 @@ var actions = map[string]BufferAction{
|
||||
"page_down": NewBufferAction("page_down", pageDown),
|
||||
"page_up": NewBufferAction("page_up", pageUp),
|
||||
|
||||
"undo": NewBufferAction("undo", Undo),
|
||||
"redo": NewBufferAction("redo", Redo),
|
||||
|
||||
"focus_left": NewBufferAction("focus_left", focusLeft),
|
||||
"focus_right": NewBufferAction("focus_right", focusRight),
|
||||
|
||||
|
@ -37,6 +37,24 @@ func Paste(v *View, commands []string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func Undo(v *View, commands []string) bool {
|
||||
b := v.getCurrentBuff()
|
||||
if b == nil {
|
||||
return false
|
||||
}
|
||||
b.table.Undo()
|
||||
return false
|
||||
}
|
||||
|
||||
func Redo(v *View, commands []string) bool {
|
||||
b := v.getCurrentBuff()
|
||||
if b == nil {
|
||||
return false
|
||||
}
|
||||
b.table.Redo()
|
||||
return false
|
||||
}
|
||||
|
||||
func genFileName(dir, prefix, suffix string) string {
|
||||
randBytes := make([]byte, 16)
|
||||
rand.Read(randBytes)
|
||||
|
Loading…
Reference in New Issue
Block a user