Fix the bug when carriage returns doubled on input (#188)

fix tests
This commit is contained in:
nikitar020 2019-01-31 18:48:55 +00:00 committed by Liam Galvin
parent 6ccfba976f
commit aad680440d
2 changed files with 5 additions and 0 deletions

View File

@ -118,6 +118,8 @@ func TestBufferWriteIncrementsCursorCorrectly(t *testing.T) {
func TestWritingNewLineAsFirstRuneOnWrappedLine(t *testing.T) {
b := NewBuffer(NewTerminalState(3, 20, CellAttributes{}, 1000))
b.terminalState.LineFeedMode = false
b.Write('a', 'b', 'c')
assert.Equal(t, uint16(3), b.terminalState.cursorX)
assert.Equal(t, uint16(0), b.terminalState.cursorY)
@ -141,6 +143,7 @@ func TestWritingNewLineAsFirstRuneOnWrappedLine(t *testing.T) {
func TestWritingNewLineAsSecondRuneOnWrappedLine(t *testing.T) {
b := NewBuffer(NewTerminalState(3, 20, CellAttributes{}, 1000))
b.terminalState.LineFeedMode = false
/*
|abc
|d
@ -624,6 +627,7 @@ dbye
func TestBufferMaxLines(t *testing.T) {
b := NewBuffer(NewTerminalState(80, 2, CellAttributes{}, 2))
b.terminalState.LineFeedMode = false
b.Write([]rune("hello")...)
b.NewLine()

View File

@ -30,6 +30,7 @@ func NewTerminalState(viewCols uint16, viewLines uint16, attr CellAttributes, ma
viewHeight: viewLines,
topMargin: 0,
bottomMargin: uint(viewLines - 1),
LineFeedMode: true,
}
b.TabReset()
return b