diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-02-01 09:04:25 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-02-07 15:33:32 +0000 |
| commit | eb0b244c891f3cb6d5ba08fb3ea8af4bc421398e (patch) | |
| tree | 01bfb12ae62b0428663a06155f5f763bd5cd5cd1 /render.c | |
| parent | url-mode: auto-detect: heuristics for parenthesis and brackets (diff) | |
render: url labels: don’t position outside window
Diffstat (limited to 'render.c')
| -rw-r--r-- | render.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -2563,10 +2563,19 @@ render_urls(struct terminal *term) term->wl->shm, width, height, shm_cookie_url(url), false, 1); const struct coord *pos = &url->start; + int x = pos->col * term->cell_width - 2 * term->cell_width; + int y = pos->row * term->cell_height - term->cell_height; + + if (x < 0) + x += 4 * term->cell_width; + if (y < 0) + y += 2 * term->cell_height; + wl_subsurface_set_position( sub_surf, - (term->margins.left + pos->col * term->cell_width - 2 * term->cell_width) / term->scale, - (term->margins.top + pos->row * term->cell_height - term->cell_height) / term->scale); + (term->margins.left + x) / term->scale, + (term->margins.top + y) / term->scale); + render_osd(term, surf, sub_surf, buf, label, term->colors.table[0], term->colors.table[3], 0xf000, width, height, margin, margin); |
