diff options
| author | Johannes Altmanninger <aclopte@gmail.com> | 2024-11-28 13:24:48 +0100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2024-12-01 22:52:42 +1100 |
| commit | 6f29950e913a05bfad8baf1f515e36cf15dd2bb2 (patch) | |
| tree | db1d8ce54341e8aac3af11c769b1e265b0903ff5 /src | |
| parent | 316bca9d6225007e32e89053dc3b8bd221d40b50 (diff) | |
Fix extra newline inserted into stdin buffers
Commit c3b01a3c9 (Add back option to scroll in stdin buffers,
2024-11-27) missed the case where the initial read
from stdin had no trailing newline:
for i in $(seq 50); do printf .; sleep .1; done | kak
After the first read, we transplant the initial newline to end.
This creates an extra newline because we already added a fake newline
to uphold buffer invariants. Fix that.
Diffstat (limited to 'src')
| -rw-r--r-- | src/buffer_utils.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/buffer_utils.cc b/src/buffer_utils.cc index f311b4c6..a4fb639b 100644 --- a/src/buffer_utils.cc +++ b/src/buffer_utils.cc @@ -249,7 +249,7 @@ Buffer* create_fifo_buffer(String name, int fd, Buffer::Flags flags, AutoScroll { m_buffer.erase({0,0}, m_buffer.next({0,0})); --insert_begin->line; - if (m_scroll == AutoScroll::NotInitially) + if (m_scroll == AutoScroll::NotInitially and have_trailing_newline) m_buffer.insert(m_buffer.end_coord(), "\n"); } else if (m_scroll == AutoScroll::No and |
