bug fix: Erase To Cursor should be inclusive

This commit is contained in:
Roman Shevchenko 2019-01-14 13:32:11 +00:00
parent 3c7b325fe5
commit 67bc276589
2 changed files with 6 additions and 6 deletions

View File

@ -924,7 +924,7 @@ func (buffer *Buffer) EraseDisplayToCursor() {
defer buffer.emitDisplayChange()
line := buffer.getCurrentLine()
for i := 0; i < int(buffer.cursorX); i++ {
for i := 0; i <= int(buffer.cursorX); i++ {
if i >= len(line.cells) {
break
}

View File

@ -508,7 +508,7 @@ func TestEraseDisplayToCursor(t *testing.T) {
lines := b.GetVisibleLines()
assert.Equal(t, "", lines[0].String())
assert.Equal(t, "", lines[1].String())
assert.Equal(t, "\x00\x00\x00ng", lines[2].String())
assert.Equal(t, "\x00\x00\x00\x00g", lines[2].String())
}