From 4f8122d2ef4d9dbd312233358dbab75610864423 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sun, 7 Oct 2012 17:46:22 +0000 Subject: [PATCH] [BUG_FIXED] (Author: Andreas Jonsson) Remove the restriction of URL parsing. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@966 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/NppNotification.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index 7f752c7a8..3fa250d7c 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -587,7 +587,7 @@ BOOL Notepad_plus::notify(SCNotification *notification) case SCN_HOTSPOTDOUBLECLICK : { - notifyView->execute(SCI_SETWORDCHARS, 0, (LPARAM)"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-+.:?&@=/%#"); + notifyView->execute(SCI_SETWORDCHARS, 0, (LPARAM)"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-+.,:?&@=/%#()"); int pos = notifyView->execute(SCI_GETCURRENTPOS); int startPos = static_cast(notifyView->execute(SCI_WORDSTARTPOSITION, pos, false)); @@ -611,6 +611,11 @@ BOOL Notepad_plus::notify(SCNotification *notification) notifyView->getGenericText(currentWord, MAX_PATH*2, startPos, endPos); + // This treatment would fail on some valid URLs where there's actually supposed to be a comma or parenthesis at the end. + int lastCharIndex = _tcsnlen(currentWord, MAX_PATH*2) - 1; + if(lastCharIndex >= 0 && (currentWord[lastCharIndex] == ',' || currentWord[lastCharIndex] == ')' || currentWord[lastCharIndex] == '(')) + currentWord[lastCharIndex] = '\0'; + ::ShellExecute(_pPublicInterface->getHSelf(), TEXT("open"), currentWord, NULL, NULL, SW_SHOW); _isHotspotDblClicked = true; notifyView->execute(SCI_SETCHARSDEFAULT);