<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/grid.c, branch 1.3.0</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.3.0</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.3.0'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2020-05-03T09:03:22Z</updated>
<entry>
<title>unicode-combining: store seen combining chains "globally" in the term struct</title>
<updated>2020-05-03T09:03:22Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-05-03T09:03:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=62e07743194c8051334ed9b23be90ce31ab80773'/>
<id>urn:sha1:62e07743194c8051334ed9b23be90ce31ab80773</id>
<content type='text'>
Instead of storing combining data per cell, realize that most
combinations are re-occurring and that there's lots of available space
left in the unicode range, and store seen base+combining combinations
chains in a per-terminal array.

When we encounter a combining character, we first try to pre-compose,
like before. If that fails, we then search for the current
base+combining combo in the list of previously seen combinations. If
not found there either, we allocate a new combo and add it to the
list. Regardless, the result is an index into this array. We store
this index, offsetted by COMB_CHARS_LO=0x40000000ul in the cell.

When rendering, we need to check if the cell character is a plain
character, or if it's a composed character (identified by checking if
the cell character is &gt;= COMB_CHARS_LO).

Then we render the grapheme pretty much like before.
</content>
</entry>
<entry>
<title>unicode-combine: remove utf8proc dependency</title>
<updated>2020-05-02T15:29:00Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-05-02T15:29:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d945b68b734427a03d114716ff8aeac7998a7c57'/>
<id>urn:sha1:d945b68b734427a03d114716ff8aeac7998a7c57</id>
<content type='text'>
We only used utf8proc to try to pre-compose a glyph from a base and
combining character.

We can do this ourselves by using a pre-compiled table of valid
pre-compositions. This table isn't _that_ big, and binary searching it
is fast.

That is, for a very small amount of code, and not too much extra RO
data, we can get rid of the utf8proc dependency.
</content>
</entry>
<entry>
<title>unicode-combining: completely remove unicode combining characters when feature is disabled</title>
<updated>2020-05-01T10:05:38Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-05-01T10:05:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3474624c2c17058f0fd9f3f1821971e7213d285b'/>
<id>urn:sha1:3474624c2c17058f0fd9f3f1821971e7213d285b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>grid: reflow: copy combining characters</title>
<updated>2020-05-01T09:55:22Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-05-01T09:55:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=40bf01a8e69912397fa8ed9b9c0662bdce0e84f9'/>
<id>urn:sha1:40bf01a8e69912397fa8ed9b9c0662bdce0e84f9</id>
<content type='text'>
</content>
</entry>
<entry>
<title>grid: add per-cell combining characters</title>
<updated>2020-05-01T09:49:11Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-05-01T09:49:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b2c4115f3e5b36ff04b2f7ff1af4d7bce787a16f'/>
<id>urn:sha1:b2c4115f3e5b36ff04b2f7ff1af4d7bce787a16f</id>
<content type='text'>
The data is *not* added to the cell struct, since that one is too
performance critical.

Instead, the data is added as a separate array in the row struct.

This allows our performance critical code paths that e.g. clear cells
to perform as before.
</content>
</entry>
<entry>
<title>util.h: new header file defining commonly used macros</title>
<updated>2020-05-01T09:46:24Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-05-01T09:46:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=69c3e744983e37662fa7b4f61482fb1d142e257c'/>
<id>urn:sha1:69c3e744983e37662fa7b4f61482fb1d142e257c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>grid: reflow: make tracking_points array 'const'</title>
<updated>2020-04-17T20:19:59Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-04-17T20:17:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5e2e59679b23010a04d04bbe9473dba89bd6dd30'/>
<id>urn:sha1:5e2e59679b23010a04d04bbe9473dba89bd6dd30</id>
<content type='text'>
The elements aren't, and cannot be, const. But the array itself can,
and should be.
</content>
</entry>
<entry>
<title>grid: reflow: caller may now pass a list of coordinates that should be translated</title>
<updated>2020-04-17T19:04:32Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-04-17T19:04:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ef52ed8a109af7512bd9e9ed62d74e36ae2deb41'/>
<id>urn:sha1:ef52ed8a109af7512bd9e9ed62d74e36ae2deb41</id>
<content type='text'>
</content>
</entry>
<entry>
<title>grid: reflow: generalize cursor coordinate translation</title>
<updated>2020-04-17T19:00:37Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-04-17T19:00:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e5521ff79af196cc44d61604bc52c69b997be091'/>
<id>urn:sha1:e5521ff79af196cc44d61604bc52c69b997be091</id>
<content type='text'>
Define a list of "tracking points" - coordinates that should be
translated while reflowing.

Add the cursor coordinates to this list.

When a coordinate have been translated, it is removed from the
list. This means we don't have to create a copy of the 'cursor'
coordinate struct.
</content>
</entry>
<entry>
<title>grid: reflow: remove commented out code</title>
<updated>2020-04-17T18:48:22Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-04-17T18:48:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=91a71b4147102e031aeb9952dfab920928998198'/>
<id>urn:sha1:91a71b4147102e031aeb9952dfab920928998198</id>
<content type='text'>
</content>
</entry>
<entry>
<title>grid: reflow: turn line-wrapping code into a macro</title>
<updated>2020-04-17T18:46:08Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-04-17T18:46:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=aede474a52460fda2773e703b886172f9db74412'/>
<id>urn:sha1:aede474a52460fda2773e703b886172f9db74412</id>
<content type='text'>
</content>
</entry>
<entry>
<title>grid: reflow: don't randomly insert hard linebreaks</title>
<updated>2020-04-17T18:33:08Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-04-17T18:33:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e37aa3b369b67456f490102c455b6c16367f8e02'/>
<id>urn:sha1:e37aa3b369b67456f490102c455b6c16367f8e02</id>
<content type='text'>
Not sure why I added this code; maybe to workaround issues caused by
the fact that the cursor position wasn't properly translated.
</content>
</entry>
<entry>
<title>grid: grid_reflow() now translates cursor coordinates</title>
<updated>2020-04-16T17:38:30Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-04-16T17:38:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5546b40369b7bc20201a8f3a327be0ff84af7f5a'/>
<id>urn:sha1:5546b40369b7bc20201a8f3a327be0ff84af7f5a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: improve handling of images when reflowing the grids</title>
<updated>2020-03-13T17:47:16Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-03-13T17:44:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d482bf0a304b8224499bf9de9e0781518106ec7c'/>
<id>urn:sha1:d482bf0a304b8224499bf9de9e0781518106ec7c</id>
<content type='text'>
Update the sixels' 'row' attribute when re-flowing a grid, to ensure
it is rendered at the correct place.

This should work in most cases, but will break when the cell size has
changed (e.g. font size increase/decrease, or a DPI change).

This patch also moves the sixel image list from the terminal struct
into the grid struct. The sixels are per-grid after all.
</content>
</entry>
<entry>
<title>grid: grid_reflow(): may be called with old_rows/cols == new_rows/cols</title>
<updated>2020-02-25T19:33:27Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-02-25T19:33:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=45ba9f9c8f3b38e20092d97ee6a34f7bc27e0198'/>
<id>urn:sha1:45ba9f9c8f3b38e20092d97ee6a34f7bc27e0198</id>
<content type='text'>
TODO: avoid calling grid_reflow() in this case.
</content>
</entry>
<entry>
<title>render/grid: move grid reflow code to grid.c</title>
<updated>2020-02-15T21:19:08Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-02-15T21:19:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=38a682f0d0114e118e71482ee1cfb89bc846f20d'/>
<id>urn:sha1:38a682f0d0114e118e71482ee1cfb89bc846f20d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>term: convert cell 'linefeed' attribute to a row 'linebreak' property</title>
<updated>2020-02-14T21:39:26Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-02-14T21:39:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ce8005545d5bc94775f616d0caacd55e691e400f'/>
<id>urn:sha1:ce8005545d5bc94775f616d0caacd55e691e400f</id>
<content type='text'>
To do text reflow, we only need to know if a line has been explicitly
linebreaked or not. If not, that means it wrapped, and that we
should *not* insert a linebreak when reflowing text.

When reflowing text, when reaching the end of a row in the old grid,
only insert a linebreak in the new grid if the old row had been
explicitly linebreaked.

Furthermore, when reflowing text and wrapping a row in the new grid,
mark the previous row as linebreaked if either the last cell was
(the last column in the last row) empty, or the current cell (the
first column in the new row) is empty. If both are non-empty, then we
assume a linewrap.
</content>
</entry>
<entry>
<title>grid: remove commented out code</title>
<updated>2019-08-23T18:07:27Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-08-23T18:07:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0c907172495b3bd77e8ba1502044429aaf794bba'/>
<id>urn:sha1:0c907172495b3bd77e8ba1502044429aaf794bba</id>
<content type='text'>
</content>
</entry>
<entry>
<title>scrolling: optimize row access by assuming number of rows is a power of 2</title>
<updated>2019-08-22T15:33:23Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-08-22T15:33:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7c7720a3ab314e471499194f114797ca7a40afde'/>
<id>urn:sha1:7c7720a3ab314e471499194f114797ca7a40afde</id>
<content type='text'>
With this assumption, we can replace 'a % b' with 'a &amp; (b - 1)'. In
terms of instructions, this means a fast 'and' instead of a slow
'div'.

Further optimize scrolling by:

* not double-initializing empty rows. Previously, grid_row_alloc()
  called calloc(), which was then followed by a memset() when
  scrolling. This is of course unnecessary.

* Don't loop the entire set of visible rows (this was done to ensure
  all visible rows had been allocated, and to prefetch the cell
  contents).

  This isn't necessary; only newly pulled in rows can be NULL. For
  now, don't prefetch at all.
</content>
</entry>
<entry>
<title>render: add a 'clean' bit to each cell; only render cells that aren't clean</title>
<updated>2019-07-30T16:03:03Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-07-30T16:03:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=85ef9df586dfca22d16d04c9777dc38ff896223a'/>
<id>urn:sha1:85ef9df586dfca22d16d04c9777dc38ff896223a</id>
<content type='text'>
This patch takes a bit from the foreground color value in a
cell (todo: split up foreground/background into bitfields with a
separate field for 'foreground/background' has been set), and only
re-renders cells that aren't marked as clean.

Note: we use a 'clean' bit rather than a 'dirty' bit to make it easy
to erase cells - we can (keep doing) do that by simply memsetting a
cell range to 0.
</content>
</entry>
</feed>
