<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/terminal.c, branch 1.7.2</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.7.2</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.7.2'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2021-04-18T18:09:02Z</updated>
<entry>
<title>Fix comment</title>
<updated>2021-04-18T18:09:02Z</updated>
<author>
<name>Oleh Hushchenkov</name>
<email>o.hushchenkov@gmail.com</email>
</author>
<published>2021-04-18T11:05:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a2251a399ce669b8f0e2f2b52b4600217b115ff8'/>
<id>urn:sha1:a2251a399ce669b8f0e2f2b52b4600217b115ff8</id>
<content type='text'>
</content>
</entry>
<entry>
<title>term: stop reading on eof</title>
<updated>2021-04-18T18:09:01Z</updated>
<author>
<name>Oleh Hushchenkov</name>
<email>o.hushchenkov@gmail.com</email>
</author>
<published>2021-04-18T10:56:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=98db408e1a85dce809a9bde5caf11120b0710122'/>
<id>urn:sha1:98db408e1a85dce809a9bde5caf11120b0710122</id>
<content type='text'>
</content>
</entry>
<entry>
<title>term/vt: only do reverse-wrapping (‘bw’) on cub1</title>
<updated>2021-04-18T18:08:13Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-04-08T10:58:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=24e88dd224888c6fa7d621e4871e81b45ea22b50'/>
<id>urn:sha1:24e88dd224888c6fa7d621e4871e81b45ea22b50</id>
<content type='text'>
Foot currently does reverse-wrapping (‘auto_left_margin’, or ’bw’) on
everything that calls ‘term_cursor_left()’. This is wrong; it should
only be done for cub1. From man terminfo:

    auto_left_margin | bw | bw | cub1 wraps from column 0 to last
    column

This patch moves the reverse-wrapping logic from term_cursor_left() to
the handling of BS (backspace).

Closes #441
</content>
</entry>
<entry>
<title>osc: implement OSC 17+19: change selection background/foreground colors</title>
<updated>2021-04-18T18:08:08Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-04-07T06:09:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d620a7b3b43320985ac788851ee464826ff8f713'/>
<id>urn:sha1:d620a7b3b43320985ac788851ee464826ff8f713</id>
<content type='text'>
And of course, we also implement the corresponding reset sequences,
OSC 117+119.
</content>
</entry>
<entry>
<title>osc: reset background alpha when resetting the background color</title>
<updated>2021-04-18T18:08:06Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-04-07T17:04:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e853098f4608d5fa457bc873bb4fcfb23d6c2396'/>
<id>urn:sha1:e853098f4608d5fa457bc873bb4fcfb23d6c2396</id>
<content type='text'>
</content>
</entry>
<entry>
<title>terminal: drain PTY when client terminates</title>
<updated>2021-04-18T18:07:50Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-04-07T17:09:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=f42e42246fe7aba57cabc89ac5a439d03bde06b4'/>
<id>urn:sha1:f42e42246fe7aba57cabc89ac5a439d03bde06b4</id>
<content type='text'>
This is done by:

* Not limiting the number of times we try to read from the PTY when
  we’ve have POLLHUP
* Not requiring the entire the previous read to have filled our
  buffer.
* Not erroring out on EIO.
</content>
</entry>
<entry>
<title>config/terminal: refactor: remove “default_*” color members from terminal struct</title>
<updated>2021-04-18T18:07:29Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-04-07T06:07:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=292a7c5686d04160b4417ed5d57a9410ebf492cf'/>
<id>urn:sha1:292a7c5686d04160b4417ed5d57a9410ebf492cf</id>
<content type='text'>
Access the original colors in the configuration instead.
</content>
</entry>
<entry>
<title>term: free vt.osc8.uri when destroying a terminal</title>
<updated>2021-04-18T18:06:52Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-28T19:01:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3abde17b9ebf6f1b1dabdef3c6690d7b9ed3f6b7'/>
<id>urn:sha1:3abde17b9ebf6f1b1dabdef3c6690d7b9ed3f6b7</id>
<content type='text'>
Free vt.osc8.uri in term_destroy(), in the off chance, that the client
application emitted an un-terminated OSC-8 URI.
</content>
</entry>
<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>
</feed>
