<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/url-mode.c, branch 1.8.2</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.8.2</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.8.2'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2021-07-15T16:39:41Z</updated>
<entry>
<title>url-mode: use shm_get_many()</title>
<updated>2021-07-15T16:39:41Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-07-15T16:39:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=31fad5846516ee1e6135bd35f0478b93928a3759'/>
<id>urn:sha1:31fad5846516ee1e6135bd35f0478b93928a3759</id>
<content type='text'>
If we have lots of URLs, we use up a *lot* of SHM buffers (and thus
pools). Each and every one is a single mmap(), of at least 4K.

Since all URL labels are created and destroyed at the same time, it
makes sense to use a single pool for all buffers.

To do this, we must now do two passes; first one to generate the
actual string (label content), and to calculate the label sizes.

Then we use this information to allocate all SHM buffers at once, from
the same pool.

Finally, we iterate the URLs again, this time to actually render them.
</content>
</entry>
<entry>
<title>url-mode: abort when running into un-allocated scrollback memory</title>
<updated>2021-07-11T09:31:11Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-07-11T09:31:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=f030c87ee6b7f94e3704ae5c94667b7d46f30776'/>
<id>urn:sha1:f030c87ee6b7f94e3704ae5c94667b7d46f30776</id>
<content type='text'>
When tagging URL cells (in preparation for rendering URL mode), we
loop the URL’s entire range, setting the `url` attribute of all cells,
and dirtying the rows.

It is possible to create URLs that are invalid, and wrap around the
scrollback, even though the scrollback hasn’t yet been filled. For
example, by starting an OSC-8 URL, moving the cursor, and then closing
the OSC-8 URL.

These URLs are invalid, but are still rendered just fine. “Fine” being
relative - they will typically fill the entire screen. But at least
that’s a very clear indication for the user that’s something is wrong.

The problem is when we hit un-allocated scrollback rows. We didn’t
check for NULL rows, and crashed.

This has now been fixed.
</content>
</entry>
<entry>
<title>url-mode: fix crash when removing duplicate and/or overlapping URLs</title>
<updated>2021-07-11T08:06:12Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-07-11T08:06:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=cf6d04f9f2fcb7a4f12d35edd0a6d4cd5591b59c'/>
<id>urn:sha1:cf6d04f9f2fcb7a4f12d35edd0a6d4cd5591b59c</id>
<content type='text'>
Removing overlaping and duplicated URLs is done by running two nested
loops, that both iterate the same URL list.

When a duplicate is found, one of the URLs is destroyed and removed
from the list.

Deleting and removing an item *is* safe, but only as long as _no
other_ iterator has references to it.

In this case, if we remove an item from e.g. the inner iterator, we’ll
crash if the outer iterator’s *next* item is the item being removed.

Closes #627
</content>
</entry>
<entry>
<title>url-mode: purge SHM pixmaps when destroying URLs</title>
<updated>2021-07-11T07:59:17Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-07-11T07:54:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0a6e7e6167e04e1ee38cfaba4d38c2776cf474b4'/>
<id>urn:sha1:0a6e7e6167e04e1ee38cfaba4d38c2776cf474b4</id>
<content type='text'>
Unlike other surface types, the SHM cookie depends on the address of
each URL instance. This means if we enable, disable, and then enable
URL mode again (thus showing exactly the same URLs as the first time),
the URLs will have new addresses, and thus the old SHM pixmaps will
not get purged automatically.

So, manually purge them when destroying the URLs.
</content>
</entry>
<entry>
<title>url-mode: off-by-one error in end-point column of auto-detected URLs</title>
<updated>2021-06-02T06:11:14Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-06-01T16:58:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=974c3acd780c88f3d00a0c73132dcc3733fb1427'/>
<id>urn:sha1:974c3acd780c88f3d00a0c73132dcc3733fb1427</id>
<content type='text'>
When an auto-detected URL ended *on* the right-most column, the URL
endpoint was off by one, resulting in the underline in URL mode being
one character short.
</content>
</entry>
<entry>
<title>url-mode: codespell</title>
<updated>2021-05-22T15:08:14Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-05-22T15:08:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a9e8ba09322d563e2de6fb48993727b509442c83'/>
<id>urn:sha1:a9e8ba09322d563e2de6fb48993727b509442c83</id>
<content type='text'>
</content>
</entry>
<entry>
<title>url-mode: remove overlapping URLs, not just duplicates</title>
<updated>2021-05-22T14:42:43Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-05-22T14:42:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5605eb90405f732019043990cd39f1fd96e72182'/>
<id>urn:sha1:5605eb90405f732019043990cd39f1fd96e72182</id>
<content type='text'>
  echo -e '\e]8;;https://www.foo.bar\e\\https://www.foo\e]8;;\e\\.bar'

will produce an OSC-8 URL (https://www.foo) that is slightly shorter
than the auto-detected one (https://www.foo.bar).

This produces strange results in URL mode. For example, if
url.osc8-underline=always, the OSC8 underline will be removed when
url-mode is exited.

This patch changes the behavior so that auto-detected URLs that
overlap OSC-8 URLs are removed.

Note that OSC-8 URLs cannot overlap with each other, and that
auto-detected URLs also cannot overlap with each other.
</content>
</entry>
<entry>
<title>config: add url.protocols</title>
<updated>2021-05-22T12:50:47Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-05-20T15:58:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=53516aceec01779cc62af134f11bd7d9be71fcba'/>
<id>urn:sha1:53516aceec01779cc62af134f11bd7d9be71fcba</id>
<content type='text'>
This makes the protocols recognized by auto-detected URLs
configurable.

Closes #531
</content>
</entry>
<entry>
<title>config: move url-mode related options to a dedicated section, ‘url’</title>
<updated>2021-05-22T12:50:47Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-05-20T15:56:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0f483d65ceb06e40eab8d5f5291e681112f06249'/>
<id>urn:sha1:0f483d65ceb06e40eab8d5f5291e681112f06249</id>
<content type='text'>
</content>
</entry>
<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>
</feed>
