From 6f29950e913a05bfad8baf1f515e36cf15dd2bb2 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Thu, 28 Nov 2024 13:24:48 +0100 Subject: 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. --- src/buffer_utils.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/buffer_utils.cc') 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 -- cgit v1.2.3