<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/render.c, branch 1.6.2</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.6.2</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.6.2'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2020-12-20T14:46:32Z</updated>
<entry>
<title>render: fix rounding error when calculating background color with alpha</title>
<updated>2020-12-20T14:46:32Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-20T11:25:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a2ce0622c5396774c64245bb6cbd6b7dbd0d339d'/>
<id>urn:sha1:a2ce0622c5396774c64245bb6cbd6b7dbd0d339d</id>
<content type='text'>
We use pre-multiplied alpha color channels, but were having bad
rounding errors due to the alpha divider being truncated to an
integer.

The algorithm for pre-multiplying a color channel is:

  alpha_divider = 0xffff / alpha
  pre_mult_color = color / alpha_divider

In order to fix the rounding errors, we could turn ‘alpha_divider’
into a double.

That however would introduce a performance penalty since now we’d need
to do floating point math for each cell.

The algorithm can be trivially converted to:

  pre_mult_color = color * alpha / 0xffff

Since both color and alpa values are &lt; 65536, the multiplication is
“safe”; it will not overflow an uint32_t.

Closes #249
</content>
</entry>
<entry>
<title>render: ime: ensure cursor is visible</title>
<updated>2020-12-08T18:17:46Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-08T18:17:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ae01caee8ce4678de945fc18e97b95feced5fde1'/>
<id>urn:sha1:ae01caee8ce4678de945fc18e97b95feced5fde1</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: search: render IME pre-edit text correctly, hopefully</title>
<updated>2020-12-07T19:44:15Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-07T17:58:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b270f221d0328651fdac46cf081e2cbce4d74f4c'/>
<id>urn:sha1:b270f221d0328651fdac46cf081e2cbce4d74f4c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: ime: adjust cursor cell index when adjusting glyph offset</title>
<updated>2020-12-07T19:44:15Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-06T11:24:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=bcfc468fd0037ddeee64d3cf24602b570bacef3c'/>
<id>urn:sha1:bcfc468fd0037ddeee64d3cf24602b570bacef3c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: ime: wip: pre-edit</title>
<updated>2020-12-07T19:44:14Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-06T11:18:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d46dcd8ef54eba88dd76570e4b9fd2da284523e9'/>
<id>urn:sha1:d46dcd8ef54eba88dd76570e4b9fd2da284523e9</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: search: don’t access term-&gt;search.buf[] directly</title>
<updated>2020-12-07T19:44:14Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-05T22:34:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7c420004fb2db841b8c800494c865e14b3ecaffe'/>
<id>urn:sha1:7c420004fb2db841b8c800494c865e14b3ecaffe</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: codespell: cound -&gt; count</title>
<updated>2020-12-07T19:44:13Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-05T22:34:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=1ea36740290162dfda5659b04ac364b0272a3423'/>
<id>urn:sha1:1ea36740290162dfda5659b04ac364b0272a3423</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: search: glyph_offset is in *cells*, cursor position in *characters*</title>
<updated>2020-12-07T19:44:13Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-05T22:29:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b4a0f5b13b44525bd1dbdbc12e4e412fc9a0a1cb'/>
<id>urn:sha1:b4a0f5b13b44525bd1dbdbc12e4e412fc9a0a1cb</id>
<content type='text'>
When calculating the offset into the search string, from where to
start rendering, take into account that the cursor position is
in *characters*, and the glyph-offset is in *cells*.
</content>
</entry>
<entry>
<title>render: search: wcsnlen() -&gt; wcswidth()</title>
<updated>2020-12-07T19:44:13Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-05T21:51:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5ffa65a2e307e2442303d9d0ff2c2e05a1a8eca4'/>
<id>urn:sha1:5ffa65a2e307e2442303d9d0ff2c2e05a1a8eca4</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: search: handle multi-column characters</title>
<updated>2020-12-07T19:44:13Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-05T10:59:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a552610fdb721980bc455c7dc8636bc13d8f698b'/>
<id>urn:sha1:a552610fdb721980bc455c7dc8636bc13d8f698b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: search: render colorized glyphs (emojis) correctly</title>
<updated>2020-12-07T19:44:13Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-05T10:59:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=dca35215d079d11f0138a4cd2c98b76b39524a20'/>
<id>urn:sha1:dca35215d079d11f0138a4cd2c98b76b39524a20</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: ime: don’t render pre-edit string in grid while searching</title>
<updated>2020-12-07T19:44:12Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-05T10:42:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9ce0edc8bbcbdc5d269bdf573e20d959878ffa85'/>
<id>urn:sha1:9ce0edc8bbcbdc5d269bdf573e20d959878ffa85</id>
<content type='text'>
While doing a scrollback search, the pre-edit string should be
rendered in the search box, not in the grid.

Note that we don’t yet support IME in scrollback search mode. This
patch simply prevents the pre-edit text being rendered in the grid,
in the “background”, while searching.
</content>
</entry>
<entry>
<title>render: ime: draw a ‘bar’ cursor when the pre-edit cursor’s begin == end</title>
<updated>2020-12-07T19:44:11Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-04T17:43:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=2078e1675d8ec1e1c90e1ce7063d0a70d54ea167'/>
<id>urn:sha1:2078e1675d8ec1e1c90e1ce7063d0a70d54ea167</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: ime: don’t render cursor if cursor begin == end</title>
<updated>2020-12-07T19:44:10Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-03T17:39:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=83d3ae10aeea5ac7d451d789891542a1964c3faf'/>
<id>urn:sha1:83d3ae10aeea5ac7d451d789891542a1964c3faf</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: ime: calculate on-screen cursor position ourselves</title>
<updated>2020-12-07T19:44:10Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-03T17:38:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e9f99df2ab028d4385bef303bb5d77dab7b12e1f'/>
<id>urn:sha1:e9f99df2ab028d4385bef303bb5d77dab7b12e1f</id>
<content type='text'>
The position calculated by render_grid() may be -1,-1 if the cursor is
currently hidden.

This fixes a crash when trying to input IME while the cursor is
hidden.
</content>
</entry>
<entry>
<title>render: ignore IME preedit state when deciding which cursor style to render</title>
<updated>2020-12-07T19:44:10Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-03T17:37:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=4d90b200f1252e691592c98439635b7a0b2f6592'/>
<id>urn:sha1:4d90b200f1252e691592c98439635b7a0b2f6592</id>
<content type='text'>
</content>
</entry>
<entry>
<title>ime: make IME compile-time optional</title>
<updated>2020-12-07T19:44:10Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-03T17:36:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=05083110c3fad046ccf0838a364150b8d2bab888'/>
<id>urn:sha1:05083110c3fad046ccf0838a364150b8d2bab888</id>
<content type='text'>
</content>
</entry>
<entry>
<title>ime: render pre-edit text</title>
<updated>2020-12-07T19:44:10Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-02T17:52:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=8c3d48c5cdb2ae4e8bdbdc48f155f53d1a92973b'/>
<id>urn:sha1:8c3d48c5cdb2ae4e8bdbdc48f155f53d1a92973b</id>
<content type='text'>
This is done by allocating cells for the pre-edit text when receiving
the text-input::done() call, and populating them by converting the
utf-8 formatted pre-edit text to wchars.

We also convert the pre-edit cursor position to cell positions (it can
cover multiple cells).

When rendering, we simply render the pre-edit cells on-top off the
regular grid. While doing so, we also mark the underlying, “real”,
cells as dirty, to ensure they are re-rendered when the pre-edit text
is modified or removed.
</content>
</entry>
<entry>
<title>config: replace union in config struct with simple width/height members</title>
<updated>2020-11-30T02:24:38Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2020-11-30T02:24:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=adde947fc5ffc3d143040a984d0907262ac279bc'/>
<id>urn:sha1:adde947fc5ffc3d143040a984d0907262ac279bc</id>
<content type='text'>
</content>
</entry>
<entry>
<title>resize: don’t reflow text on alt screen</title>
<updated>2020-11-25T06:47:40Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-11-24T18:00:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9a498038d681e65748b5223d814758a6b7a47693'/>
<id>urn:sha1:9a498038d681e65748b5223d814758a6b7a47693</id>
<content type='text'>
Alt screen applications normally reflow/readjust themselves on a
window resize.

When we do it too, the result is graphical glitches/flashes since our
re-flowed text is rendered in one frame, and the application re-flowed
text soon thereafter.

We can’t avoid rendering some kind of re-flowed frame, since we don’t
know when, or even if, the application will update itself. To avoid
glitches, we need to render, as closely as possible, what the
application itself will render shortly.

This is actually pretty simple; we just need to copy the visible
content over from the old grid to the new grid. We don’t bother with
text re-flow, but simply truncate long lines.

To simplify things, we simply cancel any active selection (since often
times, it will be corrupted anyway when the application redraws
itself).

Since we’re not reflowing text, there’s no need to translate e.g. the
cursor position - we just keep the current position (but bounded to
the new dimensions).

Fun thing: ‘less’ gets corrupted if we don’t leave the cursor at
the (new) bottom row. To handle this, we check if the cursor (before
resize) is at the bottom row, and if so, we move it to the new bottom
row.

Closes #221
</content>
</entry>
</feed>
