mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-11 05:33:55 -04:00
render: urls: don’t display URLs whose key sequence doesn’t match
This commit is contained in:
parent
ab1224ba91
commit
5df2e990e3
1 changed files with 10 additions and 1 deletions
11
render.c
11
render.c
|
|
@ -2546,6 +2546,7 @@ render_urls(struct terminal *term)
|
||||||
const struct url *url = it->item.url;
|
const struct url *url = it->item.url;
|
||||||
const wchar_t *text = url->text;
|
const wchar_t *text = url->text;
|
||||||
const wchar_t *key = url->key;
|
const wchar_t *key = url->key;
|
||||||
|
const size_t entered_key_len = wcslen(term->url_keys);
|
||||||
|
|
||||||
struct wl_surface *surf = it->item.surf;
|
struct wl_surface *surf = it->item.surf;
|
||||||
struct wl_subsurface *sub_surf = it->item.sub_surf;
|
struct wl_subsurface *sub_surf = it->item.sub_surf;
|
||||||
|
|
@ -2553,13 +2554,21 @@ render_urls(struct terminal *term)
|
||||||
if (surf == NULL || sub_surf == NULL)
|
if (surf == NULL || sub_surf == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
bool hide = false;
|
||||||
const struct coord *pos = &url->start;
|
const struct coord *pos = &url->start;
|
||||||
const int _row
|
const int _row
|
||||||
= (pos->row
|
= (pos->row
|
||||||
- scrollback_end
|
- scrollback_end
|
||||||
+ term->grid->num_rows) & (term->grid->num_rows - 1);
|
+ term->grid->num_rows) & (term->grid->num_rows - 1);
|
||||||
|
|
||||||
if (_row < view_start || _row > view_end) {
|
if (_row < view_start || _row > view_end)
|
||||||
|
hide = true;
|
||||||
|
if (wcslen(key) <= entered_key_len)
|
||||||
|
hide = true;
|
||||||
|
if (wcsncmp(term->url_keys, key, entered_key_len) != 0)
|
||||||
|
hide = true;
|
||||||
|
|
||||||
|
if (hide) {
|
||||||
wl_surface_attach(surf, NULL, 0, 0);
|
wl_surface_attach(surf, NULL, 0, 0);
|
||||||
wl_surface_commit(surf);
|
wl_surface_commit(surf);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue