From 871c5abe5acdf0669909aa7ec5221e3597b2d624 Mon Sep 17 00:00:00 2001 From: dail8859 Date: Thu, 11 Aug 2016 21:30:36 -0400 Subject: [PATCH] Save wordchar list during hotspot click Fixes #2159 Fixes #2164 --- PowerEditor/src/NppNotification.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index fdf302c86..3b633a5ca 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -852,6 +852,13 @@ BOOL Notepad_plus::notify(SCNotification *notification) case SCN_HOTSPOTDOUBLECLICK: { + // Save the current wordChars before setting a custom list + const size_t wordBufferSize = notifyView->execute(SCI_GETWORDCHARS); + char *wordChars = new char[wordBufferSize + 1]; + notifyView->execute(SCI_GETWORDCHARS, 0, reinterpret_cast(wordChars)); + wordChars[wordBufferSize] = '\0'; + + // Set a custom list for detecting links notifyView->execute(SCI_SETWORDCHARS, 0, reinterpret_cast("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-+.,:?&@=/%#()")); auto pos = notifyView->execute(SCI_GETCURRENTPOS); @@ -884,8 +891,12 @@ BOOL Notepad_plus::notify(SCNotification *notification) ::ShellExecute(_pPublicInterface->getHSelf(), TEXT("open"), currentWord, NULL, NULL, SW_SHOW); _isHotspotDblClicked = true; - notifyView->execute(SCI_SETCHARSDEFAULT); + + // Re-set the previous wordChar list + notifyView->execute(SCI_SETWORDCHARS, 0, reinterpret_cast(wordChars)); } + + delete[] wordChars; break; }