mirror of
https://github.com/walles/moar.git
synced 2024-09-11 12:15:43 +03:00
parent
9c2f1ca57f
commit
ae34878ee5
@ -405,8 +405,9 @@ func (screen *UnixScreen) Clear() {
|
||||
}
|
||||
|
||||
// Returns the rendered line, plus how many information carrying cells went into
|
||||
// it (see headerLength inside of this function).
|
||||
// it
|
||||
func renderLine(row []Cell) (string, int) {
|
||||
// Strip trailing whitespace
|
||||
lastSignificantCellIndex := len(row) - 1
|
||||
for ; lastSignificantCellIndex >= 0; lastSignificantCellIndex-- {
|
||||
lastCell := row[lastSignificantCellIndex]
|
||||
|
@ -78,6 +78,9 @@ func TestRenderLineEmpty(t *testing.T) {
|
||||
|
||||
rendered, count := renderLine(row)
|
||||
assert.Equal(t, count, 0)
|
||||
|
||||
// All lines are expected to stand on their own, so we always need to clear
|
||||
// to EOL whether or not the line is empty.
|
||||
assert.Equal(t, rendered, "\x1b[m\x1b[K")
|
||||
}
|
||||
|
||||
@ -152,6 +155,9 @@ func TestRenderLineOnlyTrailingSpaces(t *testing.T) {
|
||||
|
||||
rendered, count := renderLine(row)
|
||||
assert.Equal(t, count, 0)
|
||||
|
||||
// All lines are expected to stand on their own, so we always need to clear
|
||||
// to EOL whether or not the line is empty.
|
||||
assert.Equal(t, rendered, "\x1b[m\x1b[K")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user