wangp / bower

A curses terminal client for the Notmuch email system
Other
119 stars 11 forks source link

Highlight Gemini Protocol URLs in Email #96

Closed jgarte closed 6 months ago

jgarte commented 2 years ago

2022-01-11-110619_1600x900_scrot

jgarte commented 2 years ago

@wangp

Where could I start looking in the bower code base if I'd like to make a PR to add this?

I'm a bit lost at the moment.

Oh, maybe here?

Would I need to extend detect_url_2?

wangp commented 2 years ago

Yes detect_url_2 should succeed if it detects a URL in String after index BeginAt, where Start and End are the start and end indexes of the URL in String. A starting point would be to search for "gemini" with string_util.unsafe_strstr and go from there. However, I would be unhappy with scanning each string twice.

Juliaria08 commented 7 months ago

Yes detect_url_2 should succeed if it detects a URL in String after index BeginAt, where Start and End are the start and end indexes of the URL in String. A starting point would be to search for "gemini" with string_util.unsafe_strstr and go from there. However, I would be unhappy with scanning each string twice.

Is there a way to see if it's in an array of elements? I'm not sure, and don't know mercurial. I don't think this would be a good idea as we're just hardcoding the valid schemes, whilst there's a RFC for schemes.

Wouldn't modifying the check to make it highlight any valid URI that follows the RFC 3986's Scheme be a better idea? Such that every scheme is not needed to be hardcoded.

wangp commented 7 months ago

We should use a multi-string search algorithm. It's probably easiest to use the POSIX regex functions to search for http|gemini. I don't see any need to highlight all possible URIs; in fact I'd prefer it did not. I can't remember ever wanting to open any URI other than http(s) straight from the mail client.