<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/terminal.h, 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-16T07:45:18Z</updated>
<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 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>sixel: empty pixels in the last sixel row doesn’t contribute to the image height</title>
<updated>2021-03-11T16:32:58Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-07T13:44:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=c181eb2bf68e2e776cff96b36489de5d45e67fe9'/>
<id>urn:sha1:c181eb2bf68e2e776cff96b36489de5d45e67fe9</id>
<content type='text'>
All-empty pixels rows in the last sixel row should not be included in
the final sixel image.

This allows applications to emit sixels whose height is not a multiple
of 6, and is how XTerm works.

This is done by tracking the largest row number that contains
non-empty pixels.

In unhook, when emitting the image, the image height is adjusted based
on this value.
</content>
</entry>
<entry>
<title>sixel: remove ‘max_col’</title>
<updated>2021-03-11T16:32:57Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-07T10:49:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=4b0e9a6bee9699b9edce6b9afc6a66734ce00a49'/>
<id>urn:sha1:4b0e9a6bee9699b9edce6b9afc6a66734ce00a49</id>
<content type='text'>
The image width *is* the maximum number of columns we’ve seen.
</content>
</entry>
<entry>
<title>sixel: get rid of an ‘imul’ in sixel_add()</title>
<updated>2021-03-11T16:32:57Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-06T21:05:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=8c65c68b734b3a0711e8d0a7282d6c7d9def5ddf'/>
<id>urn:sha1:8c65c68b734b3a0711e8d0a7282d6c7d9def5ddf</id>
<content type='text'>
By storing the current row’s byte offset into the backing image in the
terminal struct.

This replaces the ‘imul’ with a load, which can potentially be
slow. But, this data should already be in the cache.
</content>
</entry>
<entry>
<title>sixel: size provided by DECGRA does *not* limit the sixel size</title>
<updated>2021-03-06T14:03:47Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-06T14:03:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=c95c6639899a3fd50256352eb552b4f302fd6d6b'/>
<id>urn:sha1:c95c6639899a3fd50256352eb552b4f302fd6d6b</id>
<content type='text'>
Foot has, up until now, used a fixed image size when the application
used DECGRA (Raster Attributes) to “configure” the image size.

This was based on a misunderstanding, that this was how you emitted
sixels where the height was *not* a multiple of 6.

This isn’t the case. The VT340 documentation is actually pretty clear
about this:

  Ph and Pv do not limit the size of the image defined by the sixel
  data. However, Ph and Pv let you omit background sixel data from the
  image definition and still have a color background. They also
  provide a concise way for the application or terminal to encode the
  size of an image.

This is also how XTerm behaves. Test image:

  \EPq
  "1;1;1;1
  #0;2;0;0;0#1;2;100;100;0#2;2;0;100;0
  #1~~@@vv@@~~@@~~$
  #2??}}GG}}??}}??-
  #1!14@
  \E\

This uses DECGRA to set the image size to 1x1. The sixel however
is *not* clipped to 1x1, but is resized to 14x12
</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>url-mode: snapshot screen state when entering URL mode</title>
<updated>2021-02-26T08:15:45Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-22T09:22:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=54b5ae95c1bb01c5103b3ce97a8faebe75e142bb'/>
<id>urn:sha1:54b5ae95c1bb01c5103b3ce97a8faebe75e142bb</id>
<content type='text'>
Previously, we automatically exited URL mode whenever we received data
on the PTY. This was done since we don’t know _what_ has changed on
the screen, and we don’t want to display misleading jump labels.

However, this becomes a problem in curses-like applications that
periodically updates part of the screen. For example, a statusbar with
a clock.

This patch changes this behavior; instead of cancelling URL mode when
receiving PTY data, we snapshot the grid when entering URL mode.

When *rendering*, we use the snapshot:ed grid, while PTY updates
modify the “real” grid.

Snapshot:ing the grid means taking a full/deep copy of the current
grid, including sixel images etc.

Finally, it isn’t necessary to “damage” the entire view
when *entering* URL mode, since we’re at that point the renderer is in
sync with the grid. But we *do* need to damage the entire view when
exiting URL mode, since the grid changes on the “real” grid hasn’t
been tracked by the renderer.
</content>
</entry>
<entry>
<title>terminal: change type from uint32_t to bool in xtsave bitfield</title>
<updated>2021-02-23T13:20:59Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-23T13:20:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=703d23f066a63f6861fa0b8f049bc51497baf924'/>
<id>urn:sha1:703d23f066a63f6861fa0b8f049bc51497baf924</id>
<content type='text'>
</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>urls: OSC-8 URLs can now optionally be underlined outside of url-mode</title>
<updated>2021-02-21T19:15:32Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-14T20:29:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=2074f8b6563b7a6331c94a9231cd5b5af8bd7ade'/>
<id>urn:sha1:2074f8b6563b7a6331c94a9231cd5b5af8bd7ade</id>
<content type='text'>
This patch adds a new configuration option,
‘osc8-underline=url-mode|always’.

When set to ‘url-mode’, OSC-8 URLs are only
highlighted (i.e. underlined) in url-mode, just like auto-detected
URLs.

When set to ‘always’, they are always underlined, regardless of mode,
and regardless of their other attributes.

This is implemented by tagging collected URLs with a boolean,
instructing urls_render() and urls_reset() whether they should update
the cells’ ‘url’ attribute or not.

The OSC-8 collecter sets this based on the value of ‘osc8-underline’.

Finally, when closing an OSC-8 URL, the cells are immediately tagged
with the ‘url’ attribute if ‘osc8-underline’ is set to ‘always’.
</content>
</entry>
<entry>
<title>urls: add key binding that toggles whether URLs are displayed on jump-label</title>
<updated>2021-02-21T19:15:31Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-14T13:18:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=06a9ffa7632abf201b0ea0270bb5058af4fc4a6b'/>
<id>urn:sha1:06a9ffa7632abf201b0ea0270bb5058af4fc4a6b</id>
<content type='text'>
By default, the URL isn’t shown on the jump-label. For auto-detect
URLs, doing so is virtually always useless, as the URL is already
visible in the grid.

For OSC-8 URLs however, the URL is often _not_ visible in the
grid. Many times, seeing the URL is still not needed (if you’re doing
‘ls --hyperlink’, you already know what the URIs are).

But it is still useful to have a way to show the URLs.

This patch adds a new key binding action that can be used in url-mode
to toggle the URL on and off in the jump label.

It is bound to ctrl+t by default.
</content>
</entry>
<entry>
<title>urls: remove free-form ‘text’ member from URL struct</title>
<updated>2021-02-21T19:15:31Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-14T12:42:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=cc43c1b7048d2cf1cedb48ca63ecde40e2d0dbf5'/>
<id>urn:sha1:cc43c1b7048d2cf1cedb48ca63ecde40e2d0dbf5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>url-mode: multiple URL (parts) with the same ID is assigned a single key sequence</title>
<updated>2021-02-21T19:15:29Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-13T12:45:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=fb9e9513a59126831862a59ce9db2d2896299441'/>
<id>urn:sha1:fb9e9513a59126831862a59ce9db2d2896299441</id>
<content type='text'>
In case an URL is split up into multiple parts, those parts are now
treated as a single URL when it comes to key assignment.

Only the *first* URL part is actually assigned a key combo. The other
parts are ignored.

We still highlight them, but for all other purposes they are ignored.
</content>
</entry>
<entry>
<title>term: add an ‘id’ member to the the ‘row_uri_range’ struct</title>
<updated>2021-02-21T19:14:52Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-13T12:44:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ffbee5ff372787c13e68d413173ff2e3ba270b80'/>
<id>urn:sha1:ffbee5ff372787c13e68d413173ff2e3ba270b80</id>
<content type='text'>
term_osc8_close() sets it from the OSC-8 ID tracked in the VT
sub-struct.
</content>
</entry>
<entry>
<title>term: add ‘id’ parameter to term_osc8_open()</title>
<updated>2021-02-21T19:14:52Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-13T12:44:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b934969b858d8874e480cc9ee7f4ccf5657f6f2a'/>
<id>urn:sha1:b934969b858d8874e480cc9ee7f4ccf5657f6f2a</id>
<content type='text'>
The current OSC-8 URL’s ID is now tracked along with the URI itself,
and its starting point.
</content>
</entry>
<entry>
<title>terminal: add term_osc8_{open,close} functions</title>
<updated>2021-02-21T19:14:51Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-13T11:34:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=682494d45a50e81aec0618bdd2d282ad17fe27d5'/>
<id>urn:sha1:682494d45a50e81aec0618bdd2d282ad17fe27d5</id>
<content type='text'>
These functions update the OSC-8 URI state in the terminal.

term_osc8_open() tracks the beginning of an URL, by storing the start
coordinate (i.e. the current cursor location), along with the URL
itself.

Note that term_osc8_open() may not be called with an empty URL. This
is important to notice, since the way OSC-8 works, applications close
an URL by “opening” a new, empty one:

  \E]8;;https://foo.bar\e\\this is an OSC-8 URL\E]8;;\e\\

It is up to the caller to check for this, and call term_osc8_close()
instead of term_osc8_open() when the URL is empty.

However, it is *also* valid to switch directly from one URL to
another:

  \E]8;;http://123\e\\First URL\E]8;;http//456\e\\Second URL\E]8;;\e\\

This use-case *is* handled by term_osc8_open().

term_osc8_close() uses the information from term_osc8_open() to add
per-row URL data (using the new ‘extra’ row data).
</content>
</entry>
<entry>
<title>terminal: add OSC-8 state tracking to the VT sub-struct</title>
<updated>2021-02-21T19:14:51Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-13T11:34:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=841e5f0e50a65bc4787ba06a642355cf4fb514a5'/>
<id>urn:sha1:841e5f0e50a65bc4787ba06a642355cf4fb514a5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>grid: enable rows to have ‘extra’ data associated with them</title>
<updated>2021-02-21T19:14:51Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-13T11:31:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=fd87bca102321e5804fef74dac8a6d267ae46732'/>
<id>urn:sha1:fd87bca102321e5804fef74dac8a6d267ae46732</id>
<content type='text'>
This patch adds an ‘extra’ member to the row struct. It is a pointer
to a struct containing extra data to be associated with this row.

Initially, this struct contains a list of URL ranges. These
define (OSC-8) URLs on this row.

The ‘extra’ data is allocated on-demand. I.e. the pointer is NULL by
default; it is *not* allocated by grid_row_alloc().
</content>
</entry>
</feed>
