<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/csi.c, branch 1.7.0</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.7.0</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.7.0'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2021-03-16T12:07:09Z</updated>
<entry>
<title>csi: update ASCII printer function pointer when switching to/from alt screen</title>
<updated>2021-03-16T12:07:09Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-16T12:07:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d2711190326e19396dcf6f4fa21e41e8059c9ca2'/>
<id>urn:sha1:d2711190326e19396dcf6f4fa21e41e8059c9ca2</id>
<content type='text'>
This is necessary since switching screen may change how many sixels we
have in the scrollback.
</content>
</entry>
<entry>
<title>term: runtime switch between a ‘fast’ and a ‘generic’ ASCII print function</title>
<updated>2021-03-16T07:45:18Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-14T18:19:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=60b3ccc64115fb7e4b303eb1b93ba16d10fff1b5'/>
<id>urn:sha1:60b3ccc64115fb7e4b303eb1b93ba16d10fff1b5</id>
<content type='text'>
term_print() is called whenever the client application “prints”
something to the grid. It is called for both ASCII and UTF-8
characters, and needs to handle sixels, insert mode and ASCII
vs. graphical charsets.

Since it’s on the hot path, this becomes unnecessarily slow.

This patch adds a “fast” version of term_print(), tailored for the
common case: ASCII characters in non-insert mode, without any sixels
and non-graphical charsets.

A new function, term_update_ascii_printer(), has been added, and must
be called whenever:

* The currently selected charset *index* changes
* The currently selected charset changes (from ASCII to graphical, or
  vice verse)
* Sixels are added to the grid
* Sixels are removed from the grid
* Insert mode is enabled/disabled
</content>
</entry>
<entry>
<title>sixel: implement private mode 80 - sixel scrolling</title>
<updated>2021-02-26T08:28:03Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-26T08:28:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=849427bf105a4bf5c251a5aed5940cecd7234032'/>
<id>urn:sha1:849427bf105a4bf5c251a5aed5940cecd7234032</id>
<content type='text'>
When enabled (the default), sixels behave much like normal output; the
start where the cursor is, and the cursor moves with the
sixel. I.e. after emitting a sixel the cursor is left after the image;
either to the right, if private mode 8452 is enabled, or otherwise on
the next line. Terminal content is scrolled up if the sixel is larger
than the screen.

When disabled, sixels *always* start at (0,0), the cursor never moves,
and the terminal content never scrolls.

In other words, the ‘disabled’ mode is a much simpler mode.

All we need to do to support both modes is re-write the sixel-emitting
loop to:

* break early if we’re “out of rows”, i.e. we’ve reached the bottom of
  the screen.
* not linefeed, or move the cursor when scrolling is disabled

This patch also fixes a bug in the (new) implementation of private
mode 8452.

When emitting a sixel, we may break it up into smaller pieces, to
ensure a single sixel (as tracked internally) does not cross the
scrollback wrap-around.

The code that checked if we should do a linefeed or not, would skip
the linefeed on the last row of *each* such sixel piece. The correct
thing to do is to skip it only on the last row of the *last* piece.

I chose not to fix this bug in a separate patch since doing so would
have meant re-writing it again when implementing private mode 80.
</content>
</entry>
<entry>
<title>sixel: implement private mode 8452 - cursor positioning after sixel</title>
<updated>2021-02-23T09:36:02Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-16T18:11:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=03c675c6e2d9152da363eefcb1a2c3b059aac2ba'/>
<id>urn:sha1:03c675c6e2d9152da363eefcb1a2c3b059aac2ba</id>
<content type='text'>
When disabled (the default), the cursor is positioned on a new line
after emitting a sixel image.

When enabled, the cursor is positioned to the right of the sixel
image.

Closes #363
</content>
</entry>
<entry>
<title>sixel: implement private mode 1070 - private color palette</title>
<updated>2021-02-23T08:40:22Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-16T18:37:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=4aa980a6a2ce3c3dde0df99438b88969deed3e36'/>
<id>urn:sha1:4aa980a6a2ce3c3dde0df99438b88969deed3e36</id>
<content type='text'>
When enabled (the default), sixels use private color registers. That
is, the color palette from the last sixel is *not* re-used.

When disabled, sixels share (i.e. re-use) the same color palette.

Closes #362
</content>
</entry>
<entry>
<title>csi: ‘CSI 13 ; 2 t’ reply is now (0,0)</title>
<updated>2021-02-16T13:31:46Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-16T13:31:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=8658ab4bed1d51e9e4260c7c554b4c769b8d2f7f'/>
<id>urn:sha1:8658ab4bed1d51e9e4260c7c554b4c769b8d2f7f</id>
<content type='text'>
Foot previously responded with window local coordinates.

But, XTerm responds with screen *absolute* coordinates. This isn’t
possible under Wayland, thus we now report (0,0) instead. Same as we
do for ‘CSI 13 ; 0 t’.
</content>
</entry>
<entry>
<title>csi: add 47+1047 (alt screen) to DECRQM</title>
<updated>2021-02-09T19:02:29Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-09T19:02:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=fcb524fc72da86e4735d9f65d565d729d6e72a55'/>
<id>urn:sha1:fcb524fc72da86e4735d9f65d565d729d6e72a55</id>
<content type='text'>
</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>Print stack trace on assert() failure or when calling fatal_error()</title>
<updated>2021-01-16T19:56:33Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2021-01-15T20:39:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=22f25a9e4feddbc093ae01cd53bdda3c2c3a82e9'/>
<id>urn:sha1:22f25a9e4feddbc093ae01cd53bdda3c2c3a82e9</id>
<content type='text'>
Note: this uses the __sanitizer_print_stack_trace() function from the
AddressSanitizer runtime, so it only works when AddressSanitizer is
in use.
</content>
</entry>
<entry>
<title>csi: implement DECSET 47 - use alternate screen buffer</title>
<updated>2021-01-16T12:34:40Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-01-16T12:34:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e41654d4ea7cfff02d7b48eddc0a24e3b37e085e'/>
<id>urn:sha1:e41654d4ea7cfff02d7b48eddc0a24e3b37e085e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>term: keep cursor state in grid, for now, but document that it _could_ be moved</title>
<updated>2021-01-15T17:02:17Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-01-15T17:02:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=2a012f86d852bfc622a1d06eff5fad7e43db9023'/>
<id>urn:sha1:2a012f86d852bfc622a1d06eff5fad7e43db9023</id>
<content type='text'>
</content>
</entry>
<entry>
<title>csi: add support for ?1047 and ?1048</title>
<updated>2021-01-15T16:09:15Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-01-15T16:09:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a63e7983dddf224828c75adec270dc8c9948b4fa'/>
<id>urn:sha1:a63e7983dddf224828c75adec270dc8c9948b4fa</id>
<content type='text'>
* 1047 enters/leaves the alt screen, but without saving/restoring the
  cursor.
* 1048 saves/restores the cursor
* 1049 is 1047+1048

Note: when xtsaving and xtrestoring 1048, why simply save/restore the
cursor. Without having read XTerms sources, this appears to be what it
is doing.
</content>
</entry>
<entry>
<title>term/vt/csi: break out cursor save/restore to dedicated functions</title>
<updated>2021-01-15T16:08:30Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-01-15T16:08:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=bae3c871bb6f05271adba8885b394b86ba0798a8'/>
<id>urn:sha1:bae3c871bb6f05271adba8885b394b86ba0798a8</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Add xsnprintf() and remove some unnecessary strlen(3) calls</title>
<updated>2021-01-14T21:30:06Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2021-01-14T21:30:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3f4cfa338b5035b3789ea414eab9f139a18d140b'/>
<id>urn:sha1:3f4cfa338b5035b3789ea414eab9f139a18d140b</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>csi: implement DECRQM (DEC modes), for real</title>
<updated>2020-12-16T12:57:40Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-16T12:57:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=db097891f2c50020cd5f690d0613eacbf4b5f884'/>
<id>urn:sha1:db097891f2c50020cd5f690d0613eacbf4b5f884</id>
<content type='text'>
Previously, we always returned ‘2 - reset’, instead of the actual
state of the requested mode.
</content>
</entry>
<entry>
<title>csi: SGR 21 is “double underline”, not “disable bold” (according to ECMA-48)</title>
<updated>2020-12-14T18:10:30Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-14T18:10:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=04703c07f0db9e933ceda549f40cf5f30a46a724'/>
<id>urn:sha1:04703c07f0db9e933ceda549f40cf5f30a46a724</id>
<content type='text'>
</content>
</entry>
<entry>
<title>csi: fix sub-parameter versions of 38/48 SGR escapes</title>
<updated>2020-12-12T19:55:31Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-12T19:50:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9f321e60303d76c40eeff1bea931fbbead6434ff'/>
<id>urn:sha1:9f321e60303d76c40eeff1bea931fbbead6434ff</id>
<content type='text'>
Well this is embarrassing; the sub-parameter versions of the 38/48 SGR
escapes all required an extra ‘:2’ that wasn’t supposed to be there,
causing all the other sub-parameters to be shifted one step to the
right.

That is, foot expected e.g. 38:2:2:r:g:b, or 38:2:5:idx when the
correct sequences are 38:2:cs:r:g:b and 38:5:idx.

I.e. I mixed up the color-space ID (cs) of 38:2 with *type* of color:
RGB or indexed.

In addition to fixing this, this patch also adds support for a
“bastard” version of the sub-parameter based RGB escapes, where the
color-space identifier has been left out: e.g. 38:2:r:g:b. This
sequence is invalid, but applications tend to “forget” the color-space
ID...
</content>
</entry>
<entry>
<title>csi: ‘CSI s’ and ‘CSI u’ now saves/restores attributes and charsets</title>
<updated>2020-12-11T19:01:19Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-11T19:01:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=975e70dae1d94e425745fd6b6447d4e3f748b75b'/>
<id>urn:sha1:975e70dae1d94e425745fd6b6447d4e3f748b75b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>config: add ‘notify’ to possible values for ‘bell’ in foot.ini</title>
<updated>2020-12-10T17:22:48Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-10T17:22:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=15d20af2a24664b09604f1ec5f121c38f1500c32'/>
<id>urn:sha1:15d20af2a24664b09604f1ec5f121c38f1500c32</id>
<content type='text'>
When `bell=notify`, foot will trigger a desktop notification when it
receives a BEL in an unfocused window.
</content>
</entry>
</feed>
