<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/dcs.c, branch 1.15.2</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.15.2</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.15.2'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2023-06-29T13:40:00Z</updated>
<entry>
<title>sixel: special case parsing of images with an aspect ratio of 1:1</title>
<updated>2023-06-29T13:40:00Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2023-06-27T12:25:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3555e81fee4a069bf4886007082f676b8777f6f9'/>
<id>urn:sha1:3555e81fee4a069bf4886007082f676b8777f6f9</id>
<content type='text'>
Images with an aspect ratio of 1:1 are by far the most common (though
not the default).

It makes a lot of sense, performance wise, to special case
them.

Specifically, the sixel_add() function benefits greatly from this, as
it is the inner most, most heavily executed function when parsing a
sixel image.

sixel_add_many() also benefits, since allows us to drop a
multiplication. Since sixel_add_many() always called first (no other
call sites call sixel_add() directly), this has a noticeable effect on
performance.

Another thing that helps (though not as much), and not specifically
with AR 1:1 images, is special casing DECGRI a bit.

Up until now, it simply updated the current sixel parameter value. The
problem is that the default parameter value is 0. But, a value of 0
should be treated as 1. By adding a special ‘repeat_count’ variable to
the sixel struct, we can initialize it to ‘1’ when we see DECGRI, and
then simply overwrite it as the parameter value gets updated. This
allows us to drop an if..else when emitting the sixel.
</content>
</entry>
<entry>
<title>config: add tweak option to allow disabling sixels</title>
<updated>2022-04-06T17:25:43Z</updated>
<author>
<name>jvoisin</name>
<email>julien.voisin@dustri.org</email>
</author>
<published>2022-02-27T15:29:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=58a1ffe72483ffb52d617d2985851781e82a45b8'/>
<id>urn:sha1:58a1ffe72483ffb52d617d2985851781e82a45b8</id>
<content type='text'>
Closes #950
</content>
</entry>
<entry>
<title>dcs: don’t automatically buffer anything</title>
<updated>2022-03-21T19:40:51Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-03-19T19:23:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=de5226c93007c588f28a12215796c462a05e5bdf'/>
<id>urn:sha1:de5226c93007c588f28a12215796c462a05e5bdf</id>
<content type='text'>
If a request handler doesn’t define its own put() handler, simply drop
all DCS parameter data. This way, we won’t end up allocating
potentially large buffers for unsupported/unimplemented DCS requests.

Closes #959
</content>
</entry>
<entry>
<title>dcs: xtgettcap: use custom put() handler</title>
<updated>2022-03-21T19:40:50Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-03-19T19:22:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=67a228bf4b8b826544c13dac561e4965750465d7'/>
<id>urn:sha1:67a228bf4b8b826544c13dac561e4965750465d7</id>
<content type='text'>
Grow buffer exponentially, since XTGETTCAP requests can,
theoretically, be very large.
</content>
</entry>
<entry>
<title>dcs: decrqss: use a custom put() handler</title>
<updated>2022-03-21T19:40:50Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-03-19T19:13:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=af88c19561e4083b569a3bded26faa8347c017be'/>
<id>urn:sha1:af88c19561e4083b569a3bded26faa8347c017be</id>
<content type='text'>
Only buffer up to two bytes, as that’s the largest DECRQSS request we
support.
</content>
</entry>
<entry>
<title>dcs: map BSU/ESU unhook handlers directly to term_{enable,disable}_app_sync_upates()</title>
<updated>2022-03-21T19:40:50Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-03-19T19:04:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=8f064369859947fd039531c8e3239fe37656eac8'/>
<id>urn:sha1:8f064369859947fd039531c8e3239fe37656eac8</id>
<content type='text'>
That is, drop the local bsu() and esu() functions.
</content>
</entry>
<entry>
<title>dcs: prevent possibility of out-of-bounds reads in decrqss()</title>
<updated>2022-03-02T19:05:51Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2022-03-02T19:05:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=cc8e86fd2d7c2e2527e0c77237ff815888008ac4'/>
<id>urn:sha1:cc8e86fd2d7c2e2527e0c77237ff815888008ac4</id>
<content type='text'>
This could be triggered by running, for example:

    printf '\033P$qrxyz\033\\'

...which would cause a memcmp() of 4 bytes on a 2 byte string literal.

Fixes: #960
</content>
</entry>
<entry>
<title>dcs: decrqss: refactor: append_sgr_attr_n() is now a proper function</title>
<updated>2022-01-14T13:09:28Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-01-14T13:09:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b292e735bb4240cda8ed31c8f4133784c6465350'/>
<id>urn:sha1:b292e735bb4240cda8ed31c8f4133784c6465350</id>
<content type='text'>
</content>
</entry>
<entry>
<title>dcs: decrqss: add note about Ps in the reply</title>
<updated>2022-01-14T12:52:42Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-01-13T14:46:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7243b094b7a1885b898b12464276c07b95c01bf2'/>
<id>urn:sha1:7243b094b7a1885b898b12464276c07b95c01bf2</id>
<content type='text'>
</content>
</entry>
<entry>
<title>dcs: decrqss: BUG on invalid cursor style</title>
<updated>2022-01-14T12:52:42Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-01-13T14:43:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a8681ea44067208dd5692051fb084d2ed4c06a06'/>
<id>urn:sha1:a8681ea44067208dd5692051fb084d2ed4c06a06</id>
<content type='text'>
</content>
</entry>
<entry>
<title>dcs: implement DECRQSS</title>
<updated>2022-01-14T12:52:41Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-01-13T14:36:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=add530e66d7709543bad6f958002437eac71a80d'/>
<id>urn:sha1:add530e66d7709543bad6f958002437eac71a80d</id>
<content type='text'>
This patch adds support for DECRQSS (request Selection or Setting),
for the following sub-queries:

* DECSTBM   Set Top and Bottom Margins
* SGR       Set Graphic Rendition
* DECSCUSR  Set Cursor Style

Closes #798
</content>
</entry>
<entry>
<title>xtgettcap: switch from a table based internal structure, to a single char array</title>
<updated>2022-01-13T12:42:12Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-01-13T12:37:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5a032c4c6f6517e664ac7b920c3cfae8d5a25b05'/>
<id>urn:sha1:5a032c4c6f6517e664ac7b920c3cfae8d5a25b05</id>
<content type='text'>
Having the builtin terminfo DB as a table, with one entry per
capability/value pair was ineffective memory-wise - we ended up adding
~20K to the final binary size.

This patch changes the internal representation from a table, to a
single NULL-separated (and NULL-terminated) char array:

  cap1-name \0 cap1-value \0 cap2-name \0 cap2-value \0

The capabilities are still sorted; to lookup a capability we need to
scan from the beginning until we either find a match, or until the
capabilities from the DB sort higher (lexicographically) than the
searched-for capability.

The terminfo char array is 3.3K - more better than before.
</content>
</entry>
<entry>
<title>dcs: xtgettcap: handle boolean capabilities</title>
<updated>2022-01-13T12:42:11Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-01-04T21:01:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=44aad0941fff3e314ae42c3c578cfa6d61913198'/>
<id>urn:sha1:44aad0941fff3e314ae42c3c578cfa6d61913198</id>
<content type='text'>
Reply with DCS 1 + r &lt;cap&gt; ST
</content>
</entry>
<entry>
<title>dcs: implement XTGETTCAP</title>
<updated>2022-01-13T12:42:11Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-01-02T17:28:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3fa6bec91213525b031f76a67c6b685912dc6720'/>
<id>urn:sha1:3fa6bec91213525b031f76a67c6b685912dc6720</id>
<content type='text'>
We emit one DCS reply for each queried capability (like Kitty, but
unlike XTerm), as this allows us to a) not skip any capabilities in
the query, and b) reply with correct success/fail flag for each
capability.

We do not batch the entire reply - as soon as the reply for _one_
capability is done, we write it to the PTY.

Closes #846
</content>
</entry>
<entry>
<title>dcs: only log debug warnings in bsu() and esu() for unhandled params</title>
<updated>2021-04-25T20:04:46Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2021-04-25T20:04:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9026095a24daeb0adfa2b1617f18fb5082d4ea49'/>
<id>urn:sha1:9026095a24daeb0adfa2b1617f18fb5082d4ea49</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: implement P2=1 - transparent pixels</title>
<updated>2021-03-11T16:34:19Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-09T16:23:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7d315d7bf9ab0376468929f0e41fbac98370e035'/>
<id>urn:sha1:7d315d7bf9ab0376468929f0e41fbac98370e035</id>
<content type='text'>
When P2=1, empty pixels are transparent.

This patch also changes the behavior of P2=0|2, from setting empty
pixels to the default background color, to instead use the *current*
background color.

To implement this, a couple of changes are needed:

* Sixel pixels always use alpha=1.0, except for *empty* cells when
  P2=1 (i.e. transparent pixels).
* The renderer draws sixels with the OVER operator, instead of the SRC
  operator.
* The renderer *must* now render the cells beneath the sixel. As an
  optimization, this is only done for sixels where P2=1. I.e. for
  fully opaque sixels, there’s no need to render the cells beneath.

The sixel renderer isn’t yet hooked into the multi-threaded
renderer. This means *rows* (not just the cells) beneath
maybe-transparent sixels are rendered single-threaded.

Closes #391.
</content>
</entry>
<entry>
<title>debug: rename assert() to xassert(), to avoid clashing with &lt;assert.h&gt;</title>
<updated>2021-01-16T20:16:00Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2021-01-16T20:16:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e56136ce1192d04a52b01ccb41284f0b7896430e'/>
<id>urn:sha1:e56136ce1192d04a52b01ccb41284f0b7896430e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>vt: don’t ignore extra private/intermediate characters</title>
<updated>2020-12-16T13:30:49Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-16T13:30:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=2e137c0a7e747a781ec311c6aad656873072b96c'/>
<id>urn:sha1:2e137c0a7e747a781ec311c6aad656873072b96c</id>
<content type='text'>
Take ‘\E(#0’ for example - this is *not* the same as ‘\E(0’.

Up until now, foot has however treated them as the same escape,
because the handler for ‘\E(0’ didn’t verify there weren’t any _other_
private characters present.

Fix this by turning the ‘private’ array into a single 4-byte
integer. This allows us to match *all* privates with a single
comparison.

Private characters are added to the LSB first, and MSB last. This
means we can check for single privates in pretty much the same way as
before:

  switch (term-&gt;vt.private) {
  case ‘?’:
      ...
      break;
  }

Checking for two (or more) is much uglier, but foot only supports
a *single* escape with two privates, and no escapes with three or
more:

  switch (term-&gt;vt.private) {
  case 0x243f:  /* ‘?$’ */
      ...
      break;
  }

The ‘clear’ action remains simple (and fast), with a single write
operation.

Collecting privates is potentially _slightly_ more complex than
before; we now need mask and compare, instead of simply comparing,
when checking how many privates we already have.

We _could_ add a counter, which would make collecting privates easier,
but this would add an additional write to the ‘clean’ action which is
really bad since it’s in the hot path.
</content>
</entry>
<entry>
<title>sixel: initial support</title>
<updated>2020-02-21T20:53:23Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-02-21T20:53:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9e3bfb1eab2c7b1c7a1ec6021331fddc57e8a266'/>
<id>urn:sha1:9e3bfb1eab2c7b1c7a1ec6021331fddc57e8a266</id>
<content type='text'>
This implements basic parsing of sixel data. Lots of limitations and
temporary solutions as this is still work-in-progress:

* Maximum image size hardcoded to 800x800
* No HLS color format support
* Image is always rendered at 0x0 in the terminal
</content>
</entry>
<entry>
<title>dcs: fix comment: ESU is *End* synchronized update</title>
<updated>2020-01-29T18:43:58Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-29T18:43:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=26d39fe96e78f835a8c8cee39e2a6f44699c4838'/>
<id>urn:sha1:26d39fe96e78f835a8c8cee39e2a6f44699c4838</id>
<content type='text'>
</content>
</entry>
</feed>
