summaryrefslogtreecommitdiff
path: root/test/commands/edit-fifo-noscroll
AgeCommit message (Collapse)Author
2024-08-13Try to make tests less timing sensitiveMaxime Coste
2024-05-10Fix tests that were failing on alpineMaxime Coste
Ensure perl exists for git blame tests, replace timing sensitive `ui_out -ignore ...` with `ui_out -until '...'`
2024-02-18Fix edit-fifo-noscroll test on BSDJohannes Altmanninger
This has been failing on FreeBSD sourcehut CI, for example https://builds.sr.ht/~mawww/job/1151241
2024-01-30Do not add trailing newline to non-scrolling fifo buffersJohannes Altmanninger
Internally, all lines have a trailing "\n". Buffers created empty (like fifo buffers) start with a single line. When reading data into fifo buffers, we insert *before* the last line's trailing newline ("last newline"). This enables autoscrolling (enabled with "edit -scroll") as long as the cursor is on the last newline. When autoscrolling is disabled, we have a special case to insert *after* the last newline. This means that a cursor on that newline won't be moved. Then we transplant the newline character from the beginning to the end of the buffer. This special case happens only on the very first fifo read; on subsequent reads, the cursor at position 1.1 will not be moved anway because insertions happen below 1.1. Since we always insert (effectively) before the last newline, fifo buffers have a trailing empty line. For autoscrolling buffers this seems correct; it gives users an obvious way to toggle autoscrolling. For non-scrolling buffers the newline is redundant. Remove it. This requires keeping track of whether the last newline comes from the fifo, or was added by us. The shortest fix I could find is to always append to the buffer if not scrolling, and then delete the added newline character if applicable. m_buffer.insert(m_scroll ? pos : m_buffer.next(pos), StringView(data, data+count)); if (not m_scroll and not m_had_trailing_newline) m_buffer.erase(pos, m_buffer.next(pos)); maybe that's the best fix overall; but erasing at the end seems better than erasing in the middle, so do that whenever possible. Reported in https://lists.sr.ht/~mawww/kakoune/%3CZbTK7qit9nzvrMkx@gmail.com%3E