Add dirty flag
All checks were successful
timw4mail/gilo/pipeline/head This commit looks good

This commit is contained in:
Timothy Warren 2021-04-01 20:26:40 -04:00
parent a1f62aa8cb
commit e2f35f5e7d
3 changed files with 10 additions and 8 deletions

View File

@ -7,6 +7,7 @@ import (
)
type document struct {
dirty bool
filename string
rows []*row
}
@ -15,6 +16,7 @@ func newDocument() *document {
var rows []*row
return &document{
false,
"",
rows,
}
@ -41,7 +43,7 @@ func (d *document) save() int {
return 0
}
file, err := os.OpenFile(d.filename, os.O_RDWR | os.O_CREATE, 0644)
file, err := os.OpenFile(d.filename, os.O_RDWR|os.O_CREATE, 0644)
if err != nil {
panic("failed to open/create file for saving")
}

View File

@ -17,8 +17,8 @@ type moveCursor struct {
}
var cursorTests = []moveCursor{
{[]string{"\x1b"}, false, &point{0,0}},
{[]string{keyRight}, true, &point{1,0}},
{[]string{"\x1b"}, false, &point{0, 0}},
{[]string{keyRight}, true, &point{1, 0}},
{[]string{keyEnd}, true, &point{14, 0}},
{[]string{keyEnd, keyHome}, true, &point{0, 0}},
{[]string{keyRight, keyLeft}, true, &point{0, 0}},