From 754b92871d23e00237ee0af6beeabdfc7908a00a Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sat, 4 Feb 2017 13:17:40 +0100 Subject: [PATCH] Fix Word char list bug Fix custom word char list doesn't take effect after relauching Notepad++. --- PowerEditor/src/Notepad_plus.cpp | 8 -------- PowerEditor/src/Notepad_plus.h | 1 - PowerEditor/src/Notepad_plus_Window.cpp | 3 +++ .../src/WinControls/Preference/preferenceDlg.cpp | 1 + PowerEditor/src/winmain.cpp | 10 +--------- 5 files changed, 5 insertions(+), 18 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 537eeb803..12c0d9bce 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -6692,14 +6692,6 @@ void Notepad_plus::restoreDefaultWordChars() _subEditView.execute(SCI_SETWORDCHARS, 0, reinterpret_cast(nppGUI._defaultWordChars.c_str())); } -void Notepad_plus::setCustomWordChars() -{ - NppParameters *pNppParam = NppParameters::getInstance(); - const NppGUI & nppGUI = pNppParam->getNppGUI(); - _mainEditView.execute(SCI_SETWORDCHARS, 0, reinterpret_cast(nppGUI._customWordChars.c_str())); - _subEditView.execute(SCI_SETWORDCHARS, 0, reinterpret_cast(nppGUI._customWordChars.c_str())); -} - void Notepad_plus::addCustomWordChars() { NppParameters *pNppParam = NppParameters::getInstance(); diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index a293500dc..addffde79 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -574,7 +574,6 @@ private: void retrieveDefaultWordChars(std::string & charList); void addCustomWordChars(); void restoreDefaultWordChars(); - void setCustomWordChars(); static int getRandomNumber(int rangeMax = -1) { diff --git a/PowerEditor/src/Notepad_plus_Window.cpp b/PowerEditor/src/Notepad_plus_Window.cpp index 59e48038e..7ff818676 100644 --- a/PowerEditor/src/Notepad_plus_Window.cpp +++ b/PowerEditor/src/Notepad_plus_Window.cpp @@ -294,6 +294,9 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin // Lauch backup task _notepad_plus_plus_core.launchDocumentBackupTask(); } + + // Make this call later to take effect + ::SendMessage(_hSelf, NPPM_INTERNAL_SETWORDCHARS, 0, 0); } diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 41f0d3989..f9342a880 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -3158,6 +3158,7 @@ INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT message, WPARAM wParam, ::GetDlgItemTextA(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT, customText, MAX_PATH-1); nppGUI._customWordChars = customText; setWarningIfNeed(); + ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETWORDCHARS, 0, 0); return TRUE; } diff --git a/PowerEditor/src/winmain.cpp b/PowerEditor/src/winmain.cpp index 95c8e665e..944488a07 100644 --- a/PowerEditor/src/winmain.cpp +++ b/PowerEditor/src/winmain.cpp @@ -377,17 +377,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int) else if (::IsIconic(hNotepad_plus)) sw = SW_RESTORE; -/* REMOVED - else - sw = SW_SHOW; - - // IMPORTANT !!! - ::ShowWindow(hNotepad_plus, sw); -DEVOMER*/ -/* ADDED */ if (sw != 0) ::ShowWindow(hNotepad_plus, sw); -/* DEDDA */ + ::SetForegroundWindow(hNotepad_plus); if (params.size() > 0) //if there are files to open, use the WM_COPYDATA system