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.
This commit is contained in:
Daniel Eklöf 2021-02-14 17:13:46 +01:00
parent 20ff492d33
commit 0e6b1f7508
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -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--;