<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/url-mode.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-06T12:06:54Z</updated>
<entry>
<title>url-mode: fix auto-detection of URLs in the top corner of the viewport</title>
<updated>2021-03-06T12:06:54Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-06T12:06:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=be980a62825a01b7c3a6b62cf59a3161bf7e0ed5'/>
<id>urn:sha1:be980a62825a01b7c3a6b62cf59a3161bf7e0ed5</id>
<content type='text'>
The ‘proto_chars’ variable is kind of like a FIFO, where characters
from the grid is pushed to the back of it. I.e. the last &lt;n&gt; bytes are
at the *end* of the array.

This was what the protocol matching logic expected. However, it was
only true after reading ‘max_prot_len’ characters from the
grid. Before that, the last &lt;n&gt; bytes from the grid was in
the *beginning* of ‘proto_chars’.

This meant we did not detect URLs starting in the top left corner of
the viewport. Test case:

  foot sh -c "echo http://test.com &amp;&amp; sleep 9999"
</content>
</entry>
<entry>
<title>url-mode: ignore keys with modifiers</title>
<updated>2021-03-04T08:43:44Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-04T08:36:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=93b02cf2b85e080269d6822678df8bbbd94efd42'/>
<id>urn:sha1:93b02cf2b85e080269d6822678df8bbbd94efd42</id>
<content type='text'>
</content>
</entry>
<entry>
<title>input: rewrite of how we match foot’s own key bindings</title>
<updated>2021-03-04T08:43:43Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-27T19:42:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5e64e06a550c2499a23f03749986791136cbbcb9'/>
<id>urn:sha1:5e64e06a550c2499a23f03749986791136cbbcb9</id>
<content type='text'>
Bindings are matched in one out of three ways:

* By translated (by XKB) symbols
* By untranslated symbols
* By raw key codes

A translated symbol is affected by pressed modifiers, some of which
can be “consumed”. Consumed modifiers to not partake in the comparison
with the binding’s modifiers. In this mode, ctrl+shift+2 maps to
ctrl+@ on a US layout.

Untranslated symbols, or un-shifted symbols refer to the “base” symbol
of the pressed key, i.e. it’s unaffected by modifiers. In this mode,
consumed modifiers *do* partake in the comparison with the binding’s
modifiers, and ctrl+shift+2 maps to ctrl+shift+2 on a US layout.

More examples: ctrl+shift+u maps to ctrl+U in the translated lookup,
while ctrl+shift+u maps to ctrl+shift+u in the untranslated lookup.

Finally, we also match raw key codes. This allows our bindings to work
using the same physical keys when the user switches between latin and
non-latin layouts.

This means key bindings in foot.ini *must* not include both +shift+
and a *shifted* key. I.e. ctrl+shift+U is not a valid combo as it
cannot be triggered. Unfortunately, this was how you were supposed to
write bindings up until now... so, we try to detect such bindings, log
a deprecation warning and then “fix” the binding for the user.

When specifying bindings in foot.ini, both ctrl+U and ctrl+shift+u are
valid, and will work. The latter is preferred though, since we cannot
detect the raw key code for the former variant. Personally, I also
prefer the latter one because it is more explicit; it’s more obvious
which keys are involved.

However, in some cases it makes more sense to use the other
variant. Typically for non-letter combos.
</content>
</entry>
<entry>
<title>Revert "url-mode: ignore keys with modifiers"</title>
<updated>2021-03-04T08:34:37Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-04T08:34:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b87b8f1170024ce31dd732852c8d162c8217f2e1'/>
<id>urn:sha1:b87b8f1170024ce31dd732852c8d162c8217f2e1</id>
<content type='text'>
This reverts commit e5cd09bf3f3b78b408052688645321e99ae2dc5e.

This needs to be applied on the consume-modifiers-for-key-bindings
branch.
</content>
</entry>
<entry>
<title>url-mode: ignore keys with modifiers</title>
<updated>2021-03-04T07:54:38Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-04T07:54:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e5cd09bf3f3b78b408052688645321e99ae2dc5e'/>
<id>urn:sha1:e5cd09bf3f3b78b408052688645321e99ae2dc5e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>url-mode: damage current view before entering URL mode</title>
<updated>2021-02-26T08:15:46Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-24T20:39:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ae0f20a53603c3e3657cbab5c548575d4d1147bb'/>
<id>urn:sha1:ae0f20a53603c3e3657cbab5c548575d4d1147bb</id>
<content type='text'>
Clear scroll damage and damage the entire viewport before entering URL
mode. This will cause us to do a full screen redraw both when entering
URL mode, and later when exiting it.

Clearing the scroll damage is necessary to ensure we don’t apply it
twice (once for the snapshot:ed grid, and later again for the real
grid), as that would result in an incorrect pixmap.

But, since we’ve cleared the scroll damage, we need to damage the
entire view to ensure we redraw the contents correctly.
</content>
</entry>
<entry>
<title>url-mode: dirty the “last cursor” cell before taking the snapshot</title>
<updated>2021-02-26T08:15:45Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-23T08:24:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=bc71e06d5f5b9f27aca373e523627c70670e979c'/>
<id>urn:sha1:bc71e06d5f5b9f27aca373e523627c70670e979c</id>
<content type='text'>
This ensures the “last cursor” cell is re-drawn (without a cursor, if
the cursor has moved), both in the snapshot:ed grid, and later, when
we switch back to the real grid.

We must also be careful and reset term-&gt;render.last_cursor.row
both when *entering* and *leaving* URL mode, to ensure it doesn’t
point to an invalid row.
</content>
</entry>
<entry>
<title>url-mode: no need to damage the entire view when exiting 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-23T08:16:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=aa10cd54eabf592d5ad79a972009887495841652'/>
<id>urn:sha1:aa10cd54eabf592d5ad79a972009887495841652</id>
<content type='text'>
The renderer will simply apply *all* accumulated damage at once, when
we render the real grid.
</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>url-mode: redirect stdin/stdout/stderr to /dev/null when opening an URL</title>
<updated>2021-02-24T20:30:58Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-24T20:30:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=8365fde980ccb7f28627805a75f4884df14d7004'/>
<id>urn:sha1:8365fde980ccb7f28627805a75f4884df14d7004</id>
<content type='text'>
This fixex an issue where TUI programs started in the parent
terminal (when running nested terminals).
</content>
</entry>
<entry>
<title>url-mode: disable debug logging</title>
<updated>2021-02-23T13:59:54Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-23T13:59:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7ee5247525e485498d05a26f816b3ab71b98db6c'/>
<id>urn:sha1:7ee5247525e485498d05a26f816b3ab71b98db6c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>url-mode: use the same key combo for all occurrences of an URL</title>
<updated>2021-02-21T19:15:33Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-21T19:10:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=11464a65de4d96f04b4abd5c32e6c092a81a7a76'/>
<id>urn:sha1:11464a65de4d96f04b4abd5c32e6c092a81a7a76</id>
<content type='text'>
</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: remove duplicate URLs</title>
<updated>2021-02-21T19:15:31Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-14T12:36:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=cf651d361f382bb572ff0ee60807a17058d4b365'/>
<id>urn:sha1:cf651d361f382bb572ff0ee60807a17058d4b365</id>
<content type='text'>
Remove URLs with the same start and end coordinates. Such duplicate
URLs can be created by emitting an OSC-8 URL with matching grid
content:

  \E]8;;http://foo\E\\http://foo\E]8;;\E\\
</content>
</entry>
<entry>
<title>url-mode: activate_url(): ensure ‘scheme’, ‘host’ and ‘path’ are free:d</title>
<updated>2021-02-21T19:15:31Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-13T12:58:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a99f9c9341d3e9e5133fb76006c9be54af4cbace'/>
<id>urn:sha1:a99f9c9341d3e9e5133fb76006c9be54af4cbace</id>
<content type='text'>
uri_parse() may succeed. But if the scheme isn’t “file”, or if the
hostname isn’t localhost, then we failed to free ‘scheme’, ‘host’ and
‘path’.
</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>url-mode: initial support for OSC-8 URLs</title>
<updated>2021-02-21T19:14:51Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-13T11:42:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=39c5057d4963b292651cb23adfd0e1127cf89188'/>
<id>urn:sha1:39c5057d4963b292651cb23adfd0e1127cf89188</id>
<content type='text'>
Things left to do: since OSC-8 URLs are stored as ranges in the
per-row ‘extra’ data member, we currently do not handle line-wrapping
URLs very well; they will be considered two separate URLs, and
assigned two different key sequences.
</content>
</entry>
<entry>
<title>url-mode: store URL in UTF-8, not UTF-32</title>
<updated>2021-02-21T19:14:51Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-13T11:28:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3339915d204d1e6ccfe948e9df050e6b16a5a84b'/>
<id>urn:sha1:3339915d204d1e6ccfe948e9df050e6b16a5a84b</id>
<content type='text'>
The only time the URL is actually in UTF-32 is when we’re collecting
it (auto-detecting it) from the grid, since cells store their
character(s) in UTF-32.

Everything *after* that prefers the URL in UTF-8. So, do the
conversion while collecting the URL.

This patch also changes the URL activation code to strip the
‘file://user@host/’ prefix from file URIs that refer to files
on the *local* computer.
</content>
</entry>
</feed>
