boxdot / gurk-rs

Signal Messenger client for terminal
GNU Affero General Public License v3.0
440 stars 33 forks source link

feat: use OSC-8 for file:// links #272

Open WhyNotHugo opened 3 months ago

WhyNotHugo commented 3 months ago

When I receive an image on Signal, gurk will show a hyperlink starting in file:///....

Often this link won't fit in a single line, so it gets wrapped. The first line might read something like file:///home/hugo/.local/share/gurk/files/2024-03, and the second line the rest of this link -20/IMG_5383.jpg.

If I try to interact with this link via my terminal, it'll only parse the first line as part of the link (e.g.: file:///home/hugo/.local/share/gurk/files/2024-03). This results in the link not working.

An escape sequence exists to work around this exact issue: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda

The escape sequence allows a terminal application to include an uncut URL around portions of the URL that get wrapped.

Implementing this for file:// links would allow interacting with wrapped URLs via a terminal. Anecdotally, senpai(IRC client) uses these for exactly this same purpose.