<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kakoune.git/test/commands/edit-fifo-noscroll/script, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.vinkies.net/kakoune.git/'/>
<entry>
<title>Try to make tests less timing sensitive</title>
<updated>2024-08-13T10:39:44+00:00</updated>
<author>
<name>Maxime Coste</name>
<email>mawww@kakoune.org</email>
</author>
<published>2024-08-13T10:39:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.vinkies.net/kakoune.git/commit/?id=238e5e76597e3518db674500ca86cb2e2021ceaf'/>
<id>238e5e76597e3518db674500ca86cb2e2021ceaf</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix tests that were failing on alpine</title>
<updated>2024-05-10T02:07:45+00:00</updated>
<author>
<name>Maxime Coste</name>
<email>mawww@kakoune.org</email>
</author>
<published>2024-05-10T02:04:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.vinkies.net/kakoune.git/commit/?id=8c2775f665fd4aae603b423362cf0d4d917fc0df'/>
<id>8c2775f665fd4aae603b423362cf0d4d917fc0df</id>
<content type='text'>
Ensure perl exists for git blame tests, replace timing sensitive
`ui_out -ignore ...` with `ui_out -until '...'`
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Ensure perl exists for git blame tests, replace timing sensitive
`ui_out -ignore ...` with `ui_out -until '...'`
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix edit-fifo-noscroll test on BSD</title>
<updated>2024-02-17T22:58:53+00:00</updated>
<author>
<name>Johannes Altmanninger</name>
<email>aclopte@gmail.com</email>
</author>
<published>2024-02-17T21:29:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.vinkies.net/kakoune.git/commit/?id=7a86602ff86819bf68a37b1c03e994412e73fda5'/>
<id>7a86602ff86819bf68a37b1c03e994412e73fda5</id>
<content type='text'>
This has been failing on FreeBSD sourcehut CI, for example
https://builds.sr.ht/~mawww/job/1151241
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This has been failing on FreeBSD sourcehut CI, for example
https://builds.sr.ht/~mawww/job/1151241
</pre>
</div>
</content>
</entry>
<entry>
<title>Do not add trailing newline to non-scrolling fifo buffers</title>
<updated>2024-01-29T21:24:27+00:00</updated>
<author>
<name>Johannes Altmanninger</name>
<email>aclopte@gmail.com</email>
</author>
<published>2024-01-28T17:23:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.vinkies.net/kakoune.git/commit/?id=582c3c56b218b9be9745efc69c2eb282bbe99b67'/>
<id>582c3c56b218b9be9745efc69c2eb282bbe99b67</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
</feed>
