From 0e6b1f7508e9f2e683227d42964c1c7092eb181a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 14 Feb 2021 17:13:46 +0100 Subject: [PATCH] term: osc-8: close: ignore zero-length URLs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- terminal.c | 5 +++++ 1 file changed, 5 insertions(+) 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--;