<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/terminal.c, branch 1.7.1</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.7.1</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.7.1'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2021-03-25T08:36:07Z</updated>
<entry>
<title>ime: move preedit state from terminal struct to the seat struct</title>
<updated>2021-03-25T08:36:07Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-23T12:03:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e8ffb05bc7fb3b996752f345b77af4b757f69776'/>
<id>urn:sha1:e8ffb05bc7fb3b996752f345b77af4b757f69776</id>
<content type='text'>
This ensures different seat’s don’t step on each others IME pre-edit
state.

It also removes most dependencies on having a valid term pointer for
many IME operations.

We’re still not all the way, since we support disabling IME with a
private mode, which is per terminal, not seat.

Thus, we still require the seat to have keyboard focus on one of our
windows.

Closes #324. But note that *rendering* of multiple seat’s IME pre-edit
strings is still broken.
</content>
</entry>
<entry>
<title>term: term_print(): clear line break flag</title>
<updated>2021-03-23T10:02:51Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-23T10:02:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ee75e10e71ca4f942fbbc6cdac6b20fdb57ab67f'/>
<id>urn:sha1:ee75e10e71ca4f942fbbc6cdac6b20fdb57ab67f</id>
<content type='text'>
The line break flag is used by the text reflow and text
extraction (i.e. copy-paste) logic, to determine whether or not to
insert a newline between two lines.

There’s some amount of heuristics involved in this. For example, the
client application could emit a newline, move the cursor back up, and
print text. What does that mean for us?

Foot’s behavior up until now has been this:

The line break flag is set on the row, when the application emits an
explicit linefeed. The flag is cleared when the line is erased. But
otherwise not.

This meant that emitting a linefeed and then moving the cursor back up
and printing text, did not clear the line break flag. This in turn
meant that text copied always had newlines inserted, even though that
was not the client applications intention.

By clearing the line break flag whenever _anything_ is printed to a
row, the new behavior is, in practice, that the line break flag is
only set on a row if a linefeed was that *last* thing printed to that
row.

Closes #410
</content>
</entry>
<entry>
<title>term: increase/decrease custom line-height with font size changes</title>
<updated>2021-03-21T15:29:35Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-20T14:32:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7609fbba472a767849a34ca68b21ceaeccee9565'/>
<id>urn:sha1:7609fbba472a767849a34ca68b21ceaeccee9565</id>
<content type='text'>
When the user has set a custom line-height, we now adjust it when
increasing/decreasing (“zooming”) the font size at run-time.

Previously, the line-height was fixed at the size specified in
foot.ini.
</content>
</entry>
<entry>
<title>term: update_ascii_printer(): log when we (actually) switch printer</title>
<updated>2021-03-16T11:57:25Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-16T11:57:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b601307faeb47374485e5990db5177556bce7715'/>
<id>urn:sha1:b601307faeb47374485e5990db5177556bce7715</id>
<content type='text'>
</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>term: term_print(): assume we’re *not* at the right margin</title>
<updated>2021-03-14T19:47:44Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-14T19:47:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=2451699c35f87a134144c2d61490653bf2bf4f5c'/>
<id>urn:sha1:2451699c35f87a134144c2d61490653bf2bf4f5c</id>
<content type='text'>
That is, assume we can, and should, increment the cursor column.

This changes the emitted assembly from:

   518fb:       8b 8b f8 05 00 00       mov    0x5f8(%rbx),%ecx
   51901:       ff c9                   dec    %ecx
   51903:       39 d1                   cmp    %edx,%ecx
   51905:       7e 11                   jle    51918 &lt;term_print.constprop.0+0x78&gt;
   51907:       ff c2                   inc    %edx
   51909:       89 50 10                mov    %edx,0x10(%rax)
   5190c:       5b                      pop    %rbx
   5190d:       5d                      pop    %rbp
   5190e:       41 5c                   pop    %r12
   51910:       c3                      ret
   51911:       0f 1f 80 00 00 00 00    nopl   0x0(%rax)
   51918:       c6 40 18 01             movb   $0x1,0x18(%rax)
   5191c:       5b                      pop    %rbx
   5191d:       5d                      pop    %rbp
   5191e:       41 5c                   pop    %r12
   51920:       c3                      ret

To:

   5191c:       41 8d 50 01             lea    0x1(%r8),%edx
   51920:       89 50 10                mov    %edx,0x10(%rax)
   51923:       3b 93 f8 05 00 00       cmp    0x5f8(%rbx),%edx
   51929:       0f 8d 21 01 00 00       jge    51a50 &lt;term_print.constprop.0+0x190&gt;
   5192f:       5b                      pop    %rbx
   51930:       5d                      pop    %rbp
   51931:       41 5c                   pop    %r12
   51933:       c3                      ret
   ...
   51a50:       c6 40 18 01             movb   $0x1,0x18(%rax)
   51a54:       44 89 40 10             mov    %r8d,0x10(%rax)
   51a58:       5b                      pop    %rbx
   51a59:       5d                      pop    %rbp
   51a5a:       41 5c                   pop    %r12
   51a5c:       c3                      ret

I.e. it cuts the normal path from 10 instructions down to 8. It
increases the "bad" path with one extra instruction.
</content>
</entry>
<entry>
<title>term: don’t close PTY when client application dies</title>
<updated>2021-03-12T21:06:50Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-12T21:06:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=329f2a488c6b9f3b9b8e9ff940c58d8564ae9f5f'/>
<id>urn:sha1:329f2a488c6b9f3b9b8e9ff940c58d8564ae9f5f</id>
<content type='text'>
Closing it as soon as we detect that the client has died, means we may
not have drained it completely.

The PTY is either closed _by_ the client application, or by us when we
shutdown the terminal. Thus, leaving it open (until we call
term_shutdown()) is fine.
</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>grid: grid_free(): free scroll damage list</title>
<updated>2021-02-26T08:15:45Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-22T09:31:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=2cb624ee43889e66632776496b02d39fbc7d4d37'/>
<id>urn:sha1:2cb624ee43889e66632776496b02d39fbc7d4d37</id>
<content type='text'>
</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>grid: add grid_free()</title>
<updated>2021-02-26T08:15:45Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-22T09:20:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=bb74fe3f7de2b2e933eee9b0d36a811efabedb2e'/>
<id>urn:sha1:bb74fe3f7de2b2e933eee9b0d36a811efabedb2e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>terminal: erase_cell_range: erase URI ranges affected by the erase.</title>
<updated>2021-02-23T14:10:40Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-23T14:10:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d81439e2f125850b7f360cdc99ae9b3933accd9e'/>
<id>urn:sha1:d81439e2f125850b7f360cdc99ae9b3933accd9e</id>
<content type='text'>
* Partially affected URI ranges are split up
* Completely covered URI ranges are removed
</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>terminal: osc8_close(): refactor: use grid_row_add_uri_range()</title>
<updated>2021-02-21T19:15:32Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-14T19:50:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7f13d0084ea9498fb0cfb705724e4ee7212922ac'/>
<id>urn:sha1:7f13d0084ea9498fb0cfb705724e4ee7212922ac</id>
<content type='text'>
</content>
</entry>
<entry>
<title>terminal: scroll: use grid_row_reset_extra()</title>
<updated>2021-02-21T19:15:32Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-14T19:33:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3e06362d74ebd68e9d6d675f8feb0daaa9610bf6'/>
<id>urn:sha1:3e06362d74ebd68e9d6d675f8feb0daaa9610bf6</id>
<content type='text'>
</content>
</entry>
<entry>
<title>term: osc-8: close: ignore zero-length URLs</title>
<updated>2021-02-21T19:15:31Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-14T16:13:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0e6b1f7508e9f2e683227d42964c1c7092eb181a'/>
<id>urn:sha1:0e6b1f7508e9f2e683227d42964c1c7092eb181a</id>
<content type='text'>
If the client application emitted e.g:

  \E]8;;http://foo\E\\\E]8;;\E\\

i.e. an anchor without content, then we ended up with an ‘end’
coordinate that lied *before* the ‘start’ coordinate, since we
subtract one (column) from the end point to make it inclusive.
</content>
</entry>
<entry>
<title>term: osc-8: open: typo: close previous URL if ‘begin’ coords are *non-negative*</title>
<updated>2021-02-21T19:15:31Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-14T16:12:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=20ff492d3341d73c43d0dfbfbb10ea0aac7deeaf'/>
<id>urn:sha1:20ff492d3341d73c43d0dfbfbb10ea0aac7deeaf</id>
<content type='text'>
</content>
</entry>
<entry>
<title>term_osc8_close(): the URL *end* column is inclusive</title>
<updated>2021-02-21T19:15:31Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-13T13:16:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=663c43c139a4cc9405dde4d0d2e4d45eeac78e92'/>
<id>urn:sha1:663c43c139a4cc9405dde4d0d2e4d45eeac78e92</id>
<content type='text'>
</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>
</feed>
