go-gh icon indicating copy to clipboard operation
go-gh copied to clipboard

hyperlink truncated at end of row isn't closed correctly

Open mcwarman opened this issue 1 year ago • 2 comments

When using a template with a hyperlink at the end, if the the line is truncated the link its closed correctly.

gh api notifications --template '{{tablerow "Reason" "When" "Repo" "Title" -}}
{{ range . -}}
{{tablerow (.reason | autocolor "cyan") (timeago .updated_at) (.repository.full_name) (hyperlink "https://github.com/notifications" (.subject.title | autocolor "yellow")) -}}
{{end -}}'

Below output is from redirecting to a file, and using sed -n l0 file

With a the available space in terminal window the link is closed correctly:

\033]8;;https://github.com/notifications\033\\build(deps): bump pre-commit helm-docs to v1.13.0\033]8;;\033\\$

When the terminal is too small, the link isn't closed

\033]8;;https://github.com/notifications\033\\build(deps):...$

Therefore turning everything after that in terminal too a link, running the following clears it printf '\e]8;;'

mcwarman avatar Feb 26 '24 10:02 mcwarman

It also looks like if you have hyperlink not at the end, it breaks all the column formatting, I'm assuming this is because the URL chars are used calculation, but then are not displayed.

mcwarman avatar Feb 26 '24 11:02 mcwarman

Probably related to this: https://github.com/muesli/reflow/issues/45

mcwarman avatar Feb 26 '24 12:02 mcwarman