From eeebf2379379a471ae4ce1bd1199c563db38a5f1 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Thu, 5 Sep 2013 21:39:10 +0000 Subject: [PATCH] [NEW_FEATURE] New feature: auto-complete matched delimiters (in progress). git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1110 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Parameters.cpp | 4 ++-- .../src/WinControls/Preference/preference.rc | 16 +++++++-------- .../WinControls/Preference/preferenceDlg.cpp | 20 +++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 398832476..6268afc88 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -4009,7 +4009,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node) int open = -1; int openVal = 0; const TCHAR *openValStr = (subChildNode->ToElement())->Attribute(TEXT("open"), &openVal); - if (openValStr && (openVal >= 0 && openVal <= 255)) + if (openValStr && (openVal >= 0 && openVal < 128)) { open = openVal; } @@ -4017,7 +4017,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node) int close = -1; int closeVal = 0; const TCHAR *closeValStr = (subChildNode->ToElement())->Attribute(TEXT("close"), &closeVal); - if (closeValStr && (closeVal >= 0 && closeVal <= 255)) + if (closeValStr && (closeVal >= 0 && closeVal <= 128)) { close = closeVal; } diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index e790bc150..f089f1493 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -326,14 +326,14 @@ BEGIN RTEXT "Open",IDC_MACHEDPAIROPEN_STATIC,307,103,25,8 LTEXT "Close",IDC_MACHEDPAIRCLOSE_STATIC,345,103,25,8 RTEXT "Matched pair 1:",IDC_MACHEDPAIR_STATIC1,248,117,70,8 - EDITTEXT IDC_MACHEDPAIROPEN_EDIT1,320,115,10,14 - EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT1,348,115,10,14 + EDITTEXT IDC_MACHEDPAIROPEN_EDIT1,320,115,14,14 + EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT1,348,115,14,14 RTEXT "Matched pair 2:",IDC_MACHEDPAIR_STATIC2,248,137,70,8 - EDITTEXT IDC_MACHEDPAIROPEN_EDIT2,320,135,10,14 - EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT2,348,135,10,14 + EDITTEXT IDC_MACHEDPAIROPEN_EDIT2,320,135,14,14 + EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT2,348,135,14,14 RTEXT "Matched pair 3:",IDC_MACHEDPAIR_STATIC3,248,157,70,8 - EDITTEXT IDC_MACHEDPAIROPEN_EDIT3,320,155,10,14 - EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT3,348,155,10,14 + EDITTEXT IDC_MACHEDPAIROPEN_EDIT3,320,155,14,14 + EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT3,348,155,14,14 END IDD_PREFERENCE_MULTIINSTANCE_BOX DIALOGEX 0, 0, 455, 185 @@ -355,10 +355,10 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN GROUPBOX "Delimiter selection settings (Ctrl + Mouse double click)",IDC_DELIMITERSETTINGS_GB_STATIC,89,44,268,89,BS_CENTER RTEXT "Open",IDD_STATIC_OPENDELIMITER,117,67,34,8 - EDITTEXT IDC_EDIT_OPENDELIMITER,156,65,10,14 + EDITTEXT IDC_EDIT_OPENDELIMITER,156,65,14,14 LTEXT "bla bla bla bla bla bla",IDD_STATIC_BLABLA,172,67,56,8 LTEXT "bla bla bla bla bla bla bla bla bla bla bla bla",IDD_STATIC_BLABLA2NDLINE,132,87,126,8 - EDITTEXT IDC_EDIT_CLOSEDELIMITER,237,65,10,14 + EDITTEXT IDC_EDIT_CLOSEDELIMITER,237,65,14,14 LTEXT "Close",IDD_STATIC_CLOSEDELIMITER,252,67,47,8 CONTROL "Allow on several lines",IDD_SEVERALLINEMODEON_CHECK, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,109,160,10 diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 6d4aee0e6..1f304b173 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -2313,10 +2313,10 @@ BOOL CALLBACK AutoCompletionDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM nbMatchedPair = 3; for (size_t i = 0; i < nbMatchedPair; ++i) { - char openChar[2]; + TCHAR openChar[2]; openChar[0] = nppGUI._matchedPairConf._matchedPairs[i].first; openChar[1] = '\0'; - char closeChar[2]; + TCHAR closeChar[2]; closeChar[0] = nppGUI._matchedPairConf._matchedPairs[i].second; closeChar[1] = '\0'; @@ -2354,23 +2354,23 @@ BOOL CALLBACK AutoCompletionDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM { nppGUI._matchedPairConf._matchedPairs.clear(); - char opener[2] = {'\0', '\0'}; - char closer[2] = {'\0', '\0'}; + TCHAR opener[2] = {'\0', '\0'}; + TCHAR closer[2] = {'\0', '\0'}; ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIROPEN_EDIT1, WM_GETTEXT, MAX_PATH, (LPARAM)opener); ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIRCLOSE_EDIT1, WM_GETTEXT, MAX_PATH, (LPARAM)closer); - if (opener[0] != '\0' && closer[0] != '\0') - nppGUI._matchedPairConf._matchedPairs.push_back(pair(opener[0], closer[0])); + if (opener[0] < 0x80 && opener[0] != '\0' && closer[0] < 0x80 && closer[0] != '\0') + nppGUI._matchedPairConf._matchedPairs.push_back(pair(static_cast(opener[0]), static_cast(closer[0]))); ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIROPEN_EDIT2, WM_GETTEXT, MAX_PATH, (LPARAM)opener); ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIRCLOSE_EDIT2, WM_GETTEXT, MAX_PATH, (LPARAM)closer); - if (opener[0] != '\0' && closer[0] != '\0') - nppGUI._matchedPairConf._matchedPairs.push_back(pair(opener[0], closer[0])); + if (opener[0] < 0x80 && opener[0] != '\0' && closer[0] < 0x80 && closer[0] != '\0') + nppGUI._matchedPairConf._matchedPairs.push_back(pair(static_cast(opener[0]), static_cast(closer[0]))); ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIROPEN_EDIT3, WM_GETTEXT, MAX_PATH, (LPARAM)opener); ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIRCLOSE_EDIT3, WM_GETTEXT, MAX_PATH, (LPARAM)closer); - if (opener[0] != '\0' && closer[0] != '\0') - nppGUI._matchedPairConf._matchedPairs.push_back(pair(opener[0], closer[0])); + if (opener[0] < 0x80 && opener[0] != '\0' && closer[0] < 0x80 && closer[0] != '\0') + nppGUI._matchedPairConf._matchedPairs.push_back(pair(static_cast(opener[0]), static_cast(closer[0]))); return TRUE; }