mirror of https://github.com/liamg/aminal.git
Fixed CSI-J-1 erase line to cursor
This commit is contained in:
parent
444f716c64
commit
db99bac004
|
@ -361,7 +361,7 @@ func (buffer *Buffer) EraseDisplayToCursor() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for i := 0; i < int(buffer.cursorY); i++ {
|
for i := 0; i < int(buffer.cursorX); i++ {
|
||||||
line.cells[i].erase()
|
line.cells[i].erase()
|
||||||
}
|
}
|
||||||
for i := uint16(0); i < buffer.cursorY; i++ {
|
for i := uint16(0); i < buffer.cursorY; i++ {
|
||||||
|
|
|
@ -383,14 +383,15 @@ func TestEraseDisplay(t *testing.T) {
|
||||||
func TestEraseDisplayToCursor(t *testing.T) {
|
func TestEraseDisplayToCursor(t *testing.T) {
|
||||||
b := NewBuffer(80, 5, CellAttributes{})
|
b := NewBuffer(80, 5, CellAttributes{})
|
||||||
b.Write([]rune("hello\nasdasd\nthing")...)
|
b.Write([]rune("hello\nasdasd\nthing")...)
|
||||||
b.MovePosition(-3, 0)
|
b.MovePosition(-2, 0)
|
||||||
b.EraseDisplayToCursor()
|
b.EraseDisplayToCursor()
|
||||||
lines := b.GetVisibleLines()
|
lines := b.GetVisibleLines()
|
||||||
assert.Equal(t, "", lines[0].String())
|
assert.Equal(t, "", lines[0].String())
|
||||||
assert.Equal(t, "", lines[1].String())
|
assert.Equal(t, "", lines[1].String())
|
||||||
assert.Equal(t, "\x00\x00ing", lines[2].String())
|
assert.Equal(t, "\x00\x00\x00ng", lines[2].String())
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEraseDisplayAfterCursor(t *testing.T) {
|
func TestEraseDisplayAfterCursor(t *testing.T) {
|
||||||
b := NewBuffer(80, 5, CellAttributes{})
|
b := NewBuffer(80, 5, CellAttributes{})
|
||||||
b.Write([]rune("hello\nasdasd\nthings")...)
|
b.Write([]rune("hello\nasdasd\nthings")...)
|
||||||
|
|
Loading…
Reference in New Issue