<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/grid.c, branch sixel-heap-buffer-overflow</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=sixel-heap-buffer-overflow</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=sixel-heap-buffer-overflow'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2025-03-29T09:16:31Z</updated>
<entry>
<title>grid: reflow: fix empty line coalescing</title>
<updated>2025-03-29T09:16:31Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-03-29T09:15:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=c8470f40c1f5a850048a5b296a944e07abae716a'/>
<id>urn:sha1:c8470f40c1f5a850048a5b296a944e07abae716a</id>
<content type='text'>
If a range of empty lines ended with a non-empty line at the very
bottom of the to-be-resized grid, all those empty lines were removed.

Closes #2011
</content>
</entry>
<entry>
<title>grid: set linebreak=false when printing to a line, not when allocating it</title>
<updated>2025-03-05T17:55:01Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-03-05T06:38:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=605694bc938ace9a7501d6730c1865ea531870df'/>
<id>urn:sha1:605694bc938ace9a7501d6730c1865ea531870df</id>
<content type='text'>
This ensures empty lines are treated correctly, and is also more in
line with how lines are handled at runtime, when filling the
scrollback.

For now, set linebreak=false as soon as something is printed on a
line. It will remain like that *until* we reach the end of an old row
with linebreak=true, at which point we set linebreak=true on the
current new line.
</content>
</entry>
<entry>
<title>grid: change default value of linebreak to true</title>
<updated>2025-03-05T17:55:01Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-03-04T07:34:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7b6efcf19a10794dd7b41e30ce706eae3a290388'/>
<id>urn:sha1:7b6efcf19a10794dd7b41e30ce706eae3a290388</id>
<content type='text'>
This way, all lines are treated as having a hard linebreak, until it's
cleared when we do an auto-wrap.

This change alone causes issues when reflowing text, as now all
trailing lines in an otherwise empty window are treated as hard
linebreaks, causing the new grid to insert lots of unwanted, empty
lines.

Fix by doing two things:

* *clear* the linebreak flag when we pull in new lines for the new
  grid. We only want to set it explicitly, when an old row has its
  linebreak flag set.
* Coalesce empty lines with linebreak=true, and only "emit" them as
  new liens in the new grid if they are followed by non-empty lines.
</content>
</entry>
<entry>
<title>grid: reflow: fix cursor reflow when LCF is set</title>
<updated>2025-02-13T07:06:21Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-02-13T07:00:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d7a4f9e99e7e3517d339df53eee3fe6b9677f9c1'/>
<id>urn:sha1:d7a4f9e99e7e3517d339df53eee3fe6b9677f9c1</id>
<content type='text'>
When the cursor is at the end of the line, with a pending wrap (LCF
set), the lcf flag should be cleared *and* the cursor moved one cell
to the right.

Before this patch, we cleared LCF, but didn't move the cursor.

Closes #1954
</content>
</entry>
<entry>
<title>grid: reflow: shell integration: no need to check for &gt;= 0</title>
<updated>2025-02-10T12:19:57Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-02-10T11:46:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7445471238bd5b78cdfce82b0e49f5bf876a0c60'/>
<id>urn:sha1:7445471238bd5b78cdfce82b0e49f5bf876a0c60</id>
<content type='text'>
</content>
</entry>
<entry>
<title>grid: reflow: don't special case the first cell in a multi-column character</title>
<updated>2025-02-10T12:19:57Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-02-10T11:38:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=eced7cf1d6e5ea8cc1f569d022ddea938cd907a6'/>
<id>urn:sha1:eced7cf1d6e5ea8cc1f569d022ddea938cd907a6</id>
<content type='text'>
Wrap *all* cell copying logic in a for-loop for the characters
width. This _should_, in theory, mean reflow of e.g. cursor
coordinates in the middle of a multi-column character works correctly.

Also fix reflow of cmd start/end integration.
</content>
</entry>
<entry>
<title>grid: performance: check for non-NULL before comparing with terminator</title>
<updated>2025-02-10T12:19:57Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-02-10T11:00:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=6a181c9f72e16b629e99dead328bcd3eb10c044d'/>
<id>urn:sha1:6a181c9f72e16b629e99dead328bcd3eb10c044d</id>
<content type='text'>
This should be slightly faster in the normal(?) case (no styled
underlines or OSC-8).
</content>
</entry>
<entry>
<title>grid: refactor reflow</title>
<updated>2025-02-10T12:19:50Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-02-10T07:57:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3d66db63ccb1baab2d78e6d104a9c15d3f6684d1'/>
<id>urn:sha1:3d66db63ccb1baab2d78e6d104a9c15d3f6684d1</id>
<content type='text'>
We've been trying to performance optimize reflow by "chunking" cells;
try to gather as many as possible, and memcpy a chunk at once.

The problem is that a) this quickly becomes very complex, and b) is
very hard to get right for multi-column characters, especially when we
need to truncate long ones due to the window being too small.

Refactor, and once again walk and copy all cells one by one. This is
slower, but at least it's correct.
</content>
</entry>
<entry>
<title>grid: pull in misc.h when TIME_REFLOW is defined</title>
<updated>2025-02-10T08:08:14Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-02-10T08:08:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=26acf41d1391afbded51137e02113c5ef9ab1edc'/>
<id>urn:sha1:26acf41d1391afbded51137e02113c5ef9ab1edc</id>
<content type='text'>
</content>
</entry>
<entry>
<title>grid: reflow: get number of spacers to insert from the old grid</title>
<updated>2025-02-06T13:02:38Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-02-05T10:36:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d7e8f29ee24365a5aeeca4460afa228a32308e49'/>
<id>urn:sha1:d7e8f29ee24365a5aeeca4460afa228a32308e49</id>
<content type='text'>
When checking if we're breaking in the middle of a multi-column
character, we counted spacers starting from the break point. But,
the character may be wider than that. Use the fact that the spacers
cells encode how many *more* there are after them; when we get to the
first one, we know exactly how wide the character is.
</content>
</entry>
<entry>
<title>grid: reflow: handle composed characters longer than 2 cells</title>
<updated>2025-02-06T06:42:38Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-01-25T13:06:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=1111f7e918a3b41512d11023ef5bf9585fa30eb4'/>
<id>urn:sha1:1111f7e918a3b41512d11023ef5bf9585fa30eb4</id>
<content type='text'>
The logic that tries to ensure we don't break a line in the middle of
a multi-cell character was flawed when the number of cells were larger
than 2.

In particular, if the number of cells to copy were limited by the
number of cells left on the current (new) line, and were less than the
length of the multi-cell character, then we failed to insert the
correct number of spacers, and also ended up misplacing the multi-cell
character; instead of pushing it to the next line, it was inserted on
the current line, even though it doesn't fit.

Also change how trailing SPACER cells are rendered (cells that are
"fillers" at then end of a line, when a multi-column character was
pushed over to the next line): don't copy the previous cell's
attributes (which may be wrong anyway), use default attributes
instead.
</content>
</entry>
<entry>
<title>grid: typo</title>
<updated>2025-02-05T12:35:16Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-01-30T08:06:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=32919b1049b2f333208920f6b3c240fe7c637f13'/>
<id>urn:sha1:32919b1049b2f333208920f6b3c240fe7c637f13</id>
<content type='text'>
</content>
</entry>
<entry>
<title>grid: reflow: regression: remove (truncate) SPACER cells at the end of line</title>
<updated>2025-01-25T07:46:21Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-01-25T07:46:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=97385b007f2bb9cd54e701e5745d6e8d607513c2'/>
<id>urn:sha1:97385b007f2bb9cd54e701e5745d6e8d607513c2</id>
<content type='text'>
When printing a double-width glyph at the end of the line, it will get
pushed to the next line if there's only one cell left on the current
line.

That last cell on the current line is filled with a SPACER value.

When reflowing the text, the SPACER cell should be "removed", so that
the double-width glyph continues directly after the text on the
previous line.

9567694bab7149afbb4e4fcc4c754272a8d25aba fixed an issue where
reflowing e.g. neofetch output incorrectly removed spaces between the
logo, and the system info. But also introduced a regression where
SPACER values no longer are removed.

This patch tries to fix it, by adding back empty cells, but NOT SPACER
cells.
</content>
</entry>
<entry>
<title>Rename various uses of "curly" in the source code with "underline"</title>
<updated>2024-07-01T19:00:16Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2024-07-01T19:00:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=674a535fc3e1260762aaecb37af4a32581d9b0c6'/>
<id>urn:sha1:674a535fc3e1260762aaecb37af4a32581d9b0c6</id>
<content type='text'>
Since "curly" could make it seem as if all underline styles are curled
(to people unfamiliar with the codebase), whereas in reality only 1 is.
</content>
</entry>
<entry>
<title>grid: merge reflow_{uri,curly}_range_start(), and reflow_{uri,curly}_range_end()</title>
<updated>2024-06-27T17:22:01Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-06-27T17:06:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=73f6982cbeb17501b097ea6ed6ca3342d46b6c7d'/>
<id>urn:sha1:73f6982cbeb17501b097ea6ed6ca3342d46b6c7d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>grid: refactor: replace {uri,curly}_range_append() with range_append()</title>
<updated>2024-06-26T17:01:54Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-06-26T17:01:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0d3f2f27e33bdee58dc1a0e0ff6a3cb39f53056f'/>
<id>urn:sha1:0d3f2f27e33bdee58dc1a0e0ff6a3cb39f53056f</id>
<content type='text'>
Also add range_append_by_ref(), with replaces
uri_range_append_no_strdup().
</content>
</entry>
<entry>
<title>grid: row_range_put(): use correct type in call to range_delete()</title>
<updated>2024-06-26T16:39:24Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-06-25T18:01:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=cb4a74e10ba97ad37df3d065ae95a8f8efa34420'/>
<id>urn:sha1:cb4a74e10ba97ad37df3d065ae95a8f8efa34420</id>
<content type='text'>
</content>
</entry>
<entry>
<title>grid: refactor: remove union range_data_for_insertion</title>
<updated>2024-06-26T16:39:24Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-06-25T08:26:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=45f4eb48fb6b4b651df6b466936dd425d9647400'/>
<id>urn:sha1:45f4eb48fb6b4b651df6b466936dd425d9647400</id>
<content type='text'>
This union is identical to row_range_data, except the URI char pointer
is const. Let's ignore that, and re-use row_range_data, casting the
URI pointer when necessary.

Also remove uri_range_insert() and curly_range_insert(), and use the
generic version of range_insert() everywhere.
</content>
</entry>
<entry>
<title>grid: grid_row_{uri,curly}_range_put(): share code</title>
<updated>2024-06-26T16:39:24Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-06-25T07:55:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=6a0110446c1c96379b5b34dfdff5236a9bee311a'/>
<id>urn:sha1:6a0110446c1c96379b5b34dfdff5236a9bee311a</id>
<content type='text'>
grid_row_uri_range_put() and grid_row_curly_range_put() now share the
same base logic.

Range specific data is passed through a union, and range specific
checks are done through switched functions.
</content>
</entry>
<entry>
<title>grid: reflow: handle styled underlines</title>
<updated>2024-06-26T16:39:23Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-06-23T22:57:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b20302c2a7bcb70844f04c122c640b88be45ff60'/>
<id>urn:sha1:b20302c2a7bcb70844f04c122c640b88be45ff60</id>
<content type='text'>
</content>
</entry>
</feed>
