aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-02-14 16:13:46 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-02-21 19:15:31 +0000
commit0e6b1f7508e9f2e683227d42964c1c7092eb181a (patch)
tree87323f7f4c13bbcaf259ea3d901583169609d7f6
parentterm: osc-8: open: typo: close previous URL if ‘begin’ coords are *non-negative* (diff)
term: osc-8: close: ignore zero-length URLs
If the client application emitted e.g: \E]8;;http://foo\E\\\E]8;;\E\\ i.e. an anchor without content, then we ended up with an ‘end’ coordinate that lied *before* the ‘start’ coordinate, since we subtract one (column) from the end point to make it inclusive.
-rw-r--r--terminal.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/terminal.c b/terminal.c
index d9834f9e..3e2eb97f 100644
--- a/terminal.c
+++ b/terminal.c
@@ -3047,6 +3047,11 @@ term_osc8_close(struct terminal *term)
.row = grid_row_absolute(term->grid, term->grid->cursor.point.row),
};
+ if (start.row == end.row && start.col == end.col) {
+ /* Zero-length URL, e.g: \E]8;;http://foo\E\\\E]8;;\E\\ */
+ goto done;
+ }
+
/* end is *inclusive */
if (--end.col < 0) {
end.row--;