From d509dcf0f1ae608b2e99d33773dfd2f21f94a20e Mon Sep 17 00:00:00 2001 From: "Alexander S. Aganichev" Date: Sun, 28 Oct 2001 20:16:00 +0000 Subject: [PATCH] More fixes for accurate URL detection --- golded3/gectnr.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/golded3/gectnr.cpp b/golded3/gectnr.cpp index f4ec676..a9ff8f3 100644 --- a/golded3/gectnr.cpp +++ b/golded3/gectnr.cpp @@ -133,10 +133,13 @@ void Container::StyleCodeHighlight(const char* text, int row, int col, bool dohi } else { if(not strnicmp(ptr, "http://", 7) or not strnicmp(ptr, "ftp://", 6) or - not strnicmp(ptr, "www.", 4) or not strnicmp(ptr, "ftp.", 4) or + (not strnicmp(ptr, "www.", 4) and not isspace(ptr[4])) or + (not strnicmp(ptr, "ftp.", 4) and not isspace(ptr[4])) or not strnicmp(ptr, "mailto:", 7)) { const char *end = ptr+4+strcspn(ptr+4, " \t\"\'<>()[]"); + if(ispunct(end[-1]) and (end[-1] != '/')) + --end; strxcpy(buf, txptr, (uint)(ptr-txptr)+1); prints(row, col+sclen, color, buf); sclen += strlen(buf);