diff --git a/kittens/hints/marks.go b/kittens/hints/marks.go index 4821b4406..41b111f30 100644 --- a/kittens/hints/marks.go +++ b/kittens/hints/marks.go @@ -174,7 +174,7 @@ var PostProcessorMap = sync.OnceValue(func() map[string]PostProcessorFunc { e -= len(url) - idx } } - for e > 1 && is_punctuation(char_at(text, e)) { // remove trailing punctuation + for e > 1 && is_punctuation(char_at(text, e-1)) { // remove trailing punctuation e-- } // truncate url at closing bracket/quote diff --git a/kittens/hints/marks_test.go b/kittens/hints/marks_test.go index 379f386ec..d48902335 100644 --- a/kittens/hints/marks_test.go +++ b/kittens/hints/marks_test.go @@ -67,6 +67,10 @@ func TestHintMarking(t *testing.T) { r(`moo`, u) r("\x1b[mhttp://test.me/1234\n\x1b[mx", "http://test.me/1234") r("\x1b[mhttp://test.me/12345\r\x1b[m6\n\x1b[mx", "http://test.me/123456") + r("http://example.com,", "http://example.com") + r("http://example.com.", "http://example.com") + r("http://example.com!", "http://example.com") + r("http://example.com?", "http://example.com") opts.Type = "linenum" m := func(text, path string, line int) {