mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-08 21:25:32 +02:00
Do not add a trailing newline when wrapping
This commit is contained in:
@@ -481,7 +481,9 @@ func (self *wrapper) wrap_text(text string) []string {
|
||||
if last_line == self.current_line.reset() {
|
||||
last_line = ""
|
||||
}
|
||||
self.append_line(last_line)
|
||||
if last_line != "" {
|
||||
self.append_line(last_line)
|
||||
}
|
||||
return self.lines
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ func TestFormatWithIndent(t *testing.T) {
|
||||
screen_width := 11
|
||||
|
||||
tx := func(text string, expected ...string) {
|
||||
q := indent + strings.Join(expected, "") + "\n"
|
||||
q := indent + strings.Join(expected, "")
|
||||
actual := WrapText(text, indent, screen_width)
|
||||
if actual != q {
|
||||
t.Fatalf("%#v\nexpected: %#v\nactual: %#v", text, q, actual)
|
||||
@@ -35,4 +35,6 @@ func TestFormatWithIndent(t *testing.T) {
|
||||
screen_width = 3
|
||||
tx("one", "one")
|
||||
tx("four", "fou\nr")
|
||||
tx("nl\n\n", "nl\n\n")
|
||||
tx("four\n\n", "fou\nr\n\n")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user