Save wordchar list during hotspot click

Fixes #2159 Fixes #2164
pull/2164/merge
dail8859 8 years ago
parent 3f4816b030
commit 871c5abe5a

@ -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<LPARAM>(wordChars));
wordChars[wordBufferSize] = '\0';
// Set a custom list for detecting links
notifyView->execute(SCI_SETWORDCHARS, 0, reinterpret_cast<LPARAM>("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<LPARAM>(wordChars));
}
delete[] wordChars;
break;
}

Loading…
Cancel
Save