Skip to content

Commit 1eb2332

Browse files
committed
Fix: confirmation to apply changes to the DB was skipped when only NULL values were modified (backported from #59)
1 parent 047c645 commit 1eb2332

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

spread/view.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ func (viewer *Viewer) View(ctx context.Context, title string, rows rowstocsv.Sou
5858
func (viewer *Viewer) edit(title string, validate func(*csvi.CellValidatedEvent) (string, error), csvWriteTo func(pOut io.Writer) error, termOut io.Writer) (*csvi.Result, error) {
5959

6060
applyChange := false
61+
myDirty := false
6162
setNull := func(e *csvi.KeyEventArgs) (*csvi.CommandResult, error) {
6263
if e.CurrentRow().Index() < viewer.HeaderLines {
6364
return &csvi.CommandResult{}, nil
@@ -71,11 +72,12 @@ func (viewer *Viewer) edit(title string, validate func(*csvi.CellValidatedEvent)
7172
return &csvi.CommandResult{Message: err.Error()}, nil
7273
}
7374
e.CurrentRow().Replace(e.CurrentCol(), viewer.Null, &uncsv.Mode{Comma: viewer.Comma})
75+
myDirty = true
7476
return &csvi.CommandResult{}, nil
7577
}
7678

7779
quit := func(app *csvi.KeyEventArgs) (*csvi.CommandResult, error) {
78-
if !app.IsDirty() {
80+
if !app.IsDirty() && !myDirty {
7981
io.WriteString(app, "\n")
8082
return &csvi.CommandResult{Quit: true}, nil
8183
}

0 commit comments

Comments
 (0)