Merge pull request #165 from c-bata/remove-empty-if-statements
Remove empty if statements
This commit is contained in:
commit
05d87ebe0e
14
buffer.go
14
buffer.go
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user