threads / patch / 54835

patchgitk: exclude common URL delimiters from linkification regex

Subject: [PATCH] gitk: exclude common URL delimiters from linkification regex

## tl;dr

One message between Dec 16, 2020 and Dec 16, 2020. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Alex Henrie· Dec 16, 2020, 06:55 UTC · lore

Angle brackets, square brackets, double quotes, and backticks are all commonly used to delineate URLs in plain text (and should be escaped when they are actually part of the URL).

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
 gitk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to gitk +1 −1
diff --git a/gitk b/gitk
index 23d9dd1..fcd6f61 100755
--- a/gitk
+++ b/gitk
@@ -7054,7 +7054,7 @@ proc appendwithlinks {text tags} {
         incr linknum
     }
     set wlinks [regexp -indices -all -inline -line \
-                    {https?://[^[:space:]]+} $text]
+                    {https?://[^[:space:]<>\[\]\"`]+} $text]
     foreach l $wlinks {
         set s2 [lindex $l 0]
         set e2 [lindex $l 1]
-- 
2.29.2

← back to recent threads