Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a subtle bug with the mark API #503

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion file/observable_editable_buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,9 @@

// Mark is a forwarding function for file.Mark.
// This sets an undo point. NB: call Mark before mutating the file.
// seq must be 1 to enable Undo/Redo on the file.
// Argument seq should be > 0 to create a valid Undo/Redo point.
func (e *ObservableEditableBuffer) Mark(seq int) {
log.Println("oeb.Mark(), before:", e.DebugSeqState(), "newseq:", seq)

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.19.x, ubuntu-latest)

undefined: log

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.19.x, ubuntu-latest)

undefined: log

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, macos-latest)

undefined: log

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, ubuntu-latest)

undefined: log

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, macos-latest)

undefined: log

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.19.x, macos-latest)

undefined: log

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.19.x, macos-latest)

undefined: log

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, ubuntu-latest)

undefined: log

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.19.x, windows-latest)

undefined: log

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.19.x, windows-latest)

undefined: log

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, windows-latest)

undefined: log

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, windows-latest)

undefined: log

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.19.x, ubuntu-latest)

undefined: log

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, macos-latest)

undefined: log

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, ubuntu-latest)

undefined: log

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.19.x, macos-latest)

undefined: log

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.19.x, windows-latest)

undefined: log

Check failure on line 196 in file/observable_editable_buffer.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, windows-latest)

undefined: log
e.f.Mark()
e.seq = seq
}
Expand Down Expand Up @@ -529,3 +530,8 @@
func (e *ObservableEditableBuffer) MakeBufferCursor(p0, p1 OffsetTuple) *BufferCursor {
return MakeBufferCursor(e.f, p0, p1)
}

// DebugSeqState returns the seq state for debugging purposes.
func (e *ObservableEditableBuffer) DebugSeqState() string {
return fmt.Sprintf("oeb seq %d putseq %d treatasclean %v", e.seq, e.putseq, e.treatasclean)
}
5 changes: 3 additions & 2 deletions xfid.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,9 @@ forloop:
case "nomark": // turn off automatic marking
w.nomark = true
case "mark": // mark file
global.seq++
w.body.file.Mark(global.seq)
w.nomark = false
// global.seq++
// w.body.file.Mark(global.seq)
case "nomenu": // turn off automatic menu
w.filemenu = false
case "menu": // enable automatic menu
Expand Down
Loading