Skip to content

Commit

Permalink
Remove HasUncommitedChanges from SaveableAndDirty
Browse files Browse the repository at this point in the history
SaveableAndDirty only needs to be true for buffers with Undo so
there's no need to invoke HasUncommitedChanges. Helps with #97 because
file.Buffer does not have a Commit concept.
  • Loading branch information
rjkroege committed Feb 9, 2022
1 parent af58c46 commit a787c7b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion file/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestFileInsertAtWithoutCommit(t *testing.T) {
}

check(t, "TestFileInsertAt after TestFileInsertAtWithoutCommit", f,
&stateSummary{true, true, false, true, s1})
&stateSummary{true, true, false, false, s1})
}

const s1 = "hi 海老麺"
Expand Down
2 changes: 1 addition & 1 deletion file/observable_editable_buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func (e *ObservableEditableBuffer) ReadC(q int) rune {
// as clean and is this File writable to a backing. They are combined in
// this method.
func (e *ObservableEditableBuffer) SaveableAndDirty() bool {
sad := (e.f.HasUncommitedChanges() || e.Dirty()) && !e.IsDirOrScratch()
sad := e.Dirty() && !e.IsDirOrScratch()
return e.details.Name != "" && sad
}

Expand Down

0 comments on commit a787c7b

Please sign in to comment.