Skip to content

Commit

Permalink
Escaping newlines in Log viewer buffer (#2119)
Browse files Browse the repository at this point in the history
  • Loading branch information
fox0430 authored Jul 28, 2024
1 parent 0d395b7 commit 99b1973
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. _#2119: https://github.com/fox0430/moe/pull/2119

Fixed
.....

- `#2119`_ Escaping newlines in Log viewer buffer

4 changes: 2 additions & 2 deletions src/moepkg/logviewerutils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ proc initEditorLogViewrBuffer*(): seq[Runes] =
if log.len == 0:
return @[ru""]

for i, l in log:
result.add l
for i, line in log:
for l in line.splitLines: result.add l
if i < log.high:
result.add ru""

Expand Down
13 changes: 13 additions & 0 deletions tests/tlogviewerutils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ suite "logviewerutils: initEditorLogViewrBuffer":
]
.toSeqRunes

test "With new line":
addMessageLog "line1.0\nline1.1"
addMessageLog "line2.0\nline2.1"

check initEditorLogViewrBuffer() == @[
"line1.0",
"line1.1",
"",
"line2.0",
"line2.1"
]
.toSeqRunes

suite "logviewerutils: initLspLogViewrBuffer":
setup:
clearMessageLog()
Expand Down

0 comments on commit 99b1973

Please sign in to comment.