lucc / nvimpager

Use nvim as a pager to view manpages, diffs, etc with nvim's syntax highlighting
Other
373 stars 20 forks source link

Wrapped URLs fail #102

Open agenbite opened 1 month ago

agenbite commented 1 month ago

Hi! I have a problem with long urls that are wrapped: they become broken for the terminal emulator. I use foot, here's what happens:

cat > /tmp/test
https://a.very.long/url/that/will/be/broken/by/page/when/it/is/wrapped/due/to/being/longer/than/the/terminal/window/which/is/problematic/when/trying/to/detect/urls/with/my/terminal/emulator
CTRL-D

nvimpager -p /tmp/test

Now, assuming the url is longer than page's window, if I hit CTRL-SHIFT-U (foot binding for "URL mode"), only the first line of the URL is recognised. This only happens inside page, not in plain less. Any way I can help debug this?

In my digging, I found this, which maybe hints a path to a solution: https://github.com/neovim/neovim/issues/28817

Thanks!

lucc commented 1 month ago

If I understand the linked issue correctly you suggest that we implement such a plugin in nvimpager:

  1. parse the text for hyperlinks
  2. add extmarks with the url option to the hyperlink

And then neovim will emit the OSC-8 sequence for the terminal.

agenbite commented 1 month ago

Indeed, I think that would solve the issue and long urls would be actionable inside nvimpager. Having said that, I have not a clear idea on how much work would that imply. But it'd be great to have that functionality, yeah! :)

Thanks for nvimpager!!