diff options
author | bptato <nincsnevem662@gmail.com> | 2021-11-17 14:44:37 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2021-11-19 21:52:31 +0100 |
commit | 42aacf6bf1a52a8ebad902d8ee5adeef57f8822a (patch) | |
tree | 05f2a15097cd4e3882adb15721c4e89aa82c1139 | |
parent | cd28af13fc6753792b3b9571abba5943f90d021e (diff) | |
download | chawan-42aacf6bf1a52a8ebad902d8ee5adeef57f8822a.tar.gz |
Ignore final newline in source view
-rw-r--r-- | src/io/buffer.nim | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/io/buffer.nim b/src/io/buffer.nim index da33ae34..f38d1b24 100644 --- a/src/io/buffer.nim +++ b/src/io/buffer.nim @@ -644,10 +644,11 @@ proc renderPlainText*(buffer: Buffer, text: string) = var format = newFormatting() while i < text.len: if text[i] == '\n': - buffer.addLine() - buffer.lines.addFormat(buffer.lines.len - 1, format) - inc y - x = 0 + if i != text.len - 1: + buffer.addLine() + buffer.lines.addFormat(buffer.lines.len - 1, format) + inc y + x = 0 inc i elif text[i] == '\r': inc i @@ -796,7 +797,7 @@ proc inputLoop(attrs: TermAttributes, buffer: Buffer): bool = var url = $buffer.location termGoto(0, buffer.height) - print("\e[K") + print(EL()) let status = readLine("URL: ", url, buffer.width) if status: buffer.setLocation(parseUri(url)) |