Skip to content

Commit

Permalink
Merge pull request #165 from c-bata/remove-empty-if-statements
Browse files Browse the repository at this point in the history
Remove empty if statements
  • Loading branch information
c-bata authored Feb 28, 2020
2 parents 5555ab3 + 91656a4 commit 05d87eb
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,30 +67,16 @@ func (b *Buffer) InsertText(v string, overwrite bool, moveCursor bool) {
// text/cursor_position should be consistent at any time, otherwise set a Document instead.)
func (b *Buffer) setText(v string) {
debug.Assert(b.cursorPosition <= len([]rune(v)), "length of input should be shorter than cursor position")
o := b.workingLines[b.workingIndex]
b.workingLines[b.workingIndex] = v

if o != v {
dummyExecutor("")
// Text is changed.
// TODO: Call callback function triggered by text changed. And also history search text should reset.
// https://github.com/jonathanslenders/python-prompt-toolkit/blob/master/prompt_toolkit/buffer.py#L380-L384
}
}

// Set cursor position. Return whether it changed.
func (b *Buffer) setCursorPosition(p int) {
o := b.cursorPosition
if p > 0 {
b.cursorPosition = p
} else {
b.cursorPosition = 0
}
if p != o {
dummyExecutor("")
// Cursor position is changed.
// TODO: Call a onCursorPositionChanged function.
}
}

func (b *Buffer) setDocument(d *Document) {
Expand Down

0 comments on commit 05d87eb

Please sign in to comment.