mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-29 07:58:01 -04:00
terminal: add term_osc8_{open,close} functions
These functions update the OSC-8 URI state in the terminal. term_osc8_open() tracks the beginning of an URL, by storing the start coordinate (i.e. the current cursor location), along with the URL itself. Note that term_osc8_open() may not be called with an empty URL. This is important to notice, since the way OSC-8 works, applications close an URL by “opening” a new, empty one: \E]8;;https://foo.bar\e\\this is an OSC-8 URL\E]8;;\e\\ It is up to the caller to check for this, and call term_osc8_close() instead of term_osc8_open() when the URL is empty. However, it is *also* valid to switch directly from one URL to another: \E]8;;http://123\e\\First URL\E]8;;http//456\e\\Second URL\E]8;;\e\\ This use-case *is* handled by term_osc8_open(). term_osc8_close() uses the information from term_osc8_open() to add per-row URL data (using the new ‘extra’ row data).
This commit is contained in:
parent
841e5f0e50
commit
682494d45a
2 changed files with 57 additions and 0 deletions
|
|
@ -689,3 +689,6 @@ void term_ime_set_cursor_rect(
|
|||
|
||||
void term_urls_reset(struct terminal *term);
|
||||
void term_collect_urls(struct terminal *term);
|
||||
|
||||
void term_osc8_open(struct terminal *term, const char *uri);
|
||||
void term_osc8_close(struct terminal *term);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue