diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index 7ae6a7485..68cf39a55 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -3,7 +3,7 @@ The comments are here for explanation, it's not necessary to translate them. --> - +
@@ -1042,6 +1042,9 @@ You can define several column markers by using white space to separate the diffe + + + diff --git a/PowerEditor/installer/nativeLang/french.xml b/PowerEditor/installer/nativeLang/french.xml index 202770687..15b014ab5 100644 --- a/PowerEditor/installer/nativeLang/french.xml +++ b/PowerEditor/installer/nativeLang/french.xml @@ -1,6 +1,6 @@ - +
@@ -862,6 +862,7 @@ + @@ -1016,6 +1017,9 @@ Vous pouvez définir plusieurs marqueurs de colonne en utilisant un espace pour + + + diff --git a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml index 77fd9be4f..74515187f 100644 --- a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml +++ b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml @@ -1,6 +1,6 @@ - +
@@ -876,6 +876,7 @@ + @@ -1028,6 +1029,9 @@ + + + diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index 7e8647b60..04b693526 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -904,7 +904,7 @@ BOOL Notepad_plus::notify(SCNotification *notification) if (_pFuncList && (!_pFuncList->isClosed()) && _pFuncList->isVisible()) _pFuncList->markEntry(); - AutoCompletion * autoC = isFromPrimary?&_autoCompleteMain:&_autoCompleteSub; + AutoCompletion * autoC = isFromPrimary ? &_autoCompleteMain : &_autoCompleteSub; autoC->update(0); break; @@ -1048,11 +1048,35 @@ BOOL Notepad_plus::notify(SCNotification *notification) case SCN_CALLTIPCLICK: { - AutoCompletion * autoC = isFromPrimary?&_autoCompleteMain:&_autoCompleteSub; + AutoCompletion * autoC = isFromPrimary ? &_autoCompleteMain : &_autoCompleteSub; autoC->callTipClick(notification->position); break; } + case SCN_AUTOCSELECTION: + { + const NppGUI& nppGui = NppParameters::getInstance().getNppGUI(); + + // if autocompletion is disabled and it is triggered manually, then both ENTER & TAB will insert the selection + if (nppGui._autocStatus == NppGUI::AutocStatus::autoc_none) + { + break; + } + + if (notification->listCompletionMethod == SC_AC_NEWLINE && !nppGui._autocInsertSelectedUseENTER) + { + notifyView->execute(SCI_AUTOCCANCEL); + notifyView->execute(SCI_NEWLINE); + } + + if (notification->listCompletionMethod == SC_AC_TAB && !nppGui._autocInsertSelectedUseTAB) + { + notifyView->execute(SCI_AUTOCCANCEL); + notifyView->execute(SCI_TAB); + } + break; + } + case RBN_HEIGHTCHANGE: { SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0); diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 45ed7caec..db1539077 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -5169,6 +5169,15 @@ void NppParameters::feedGUIParameters(TiXmlNode *node) if (optName) _nppGUI._autocIgnoreNumbers = (lstrcmp(optName, TEXT("yes")) == 0); + optName = element->Attribute(TEXT("insertSelectedItemUseENTER")); + if (optName) + _nppGUI._autocInsertSelectedUseENTER = (lstrcmp(optName, TEXT("yes")) == 0); + + optName = element->Attribute(TEXT("insertSelectedItemUseTAB")); + if (optName) + _nppGUI._autocInsertSelectedUseTAB = (lstrcmp(optName, TEXT("yes")) == 0); + + optName = element->Attribute(TEXT("funcParams")); if (optName) _nppGUI._funcParams = (lstrcmp(optName, TEXT("yes")) == 0); @@ -6346,6 +6355,12 @@ void NppParameters::createXmlTreeFromGUIParams() const TCHAR * pStr = _nppGUI._autocIgnoreNumbers ? TEXT("yes") : TEXT("no"); GUIConfigElement->SetAttribute(TEXT("autoCIgnoreNumbers"), pStr); + pStr = _nppGUI._autocInsertSelectedUseENTER ? TEXT("yes") : TEXT("no"); + GUIConfigElement->SetAttribute(TEXT("insertSelectedItemUseENTER"), pStr); + + pStr = _nppGUI._autocInsertSelectedUseTAB ? TEXT("yes") : TEXT("no"); + GUIConfigElement->SetAttribute(TEXT("insertSelectedItemUseTAB"), pStr); + pStr = _nppGUI._funcParams ? TEXT("yes") : TEXT("no"); GUIConfigElement->SetAttribute(TEXT("funcParams"), pStr); } diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 1ec45aada..1bb95c68b 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -805,6 +805,8 @@ struct NppGUI final AutocStatus _autocStatus = autoc_both; size_t _autocFromLen = 1; bool _autocIgnoreNumbers = true; + bool _autocInsertSelectedUseENTER = false; + bool _autocInsertSelectedUseTAB = true; bool _funcParams = true; MatchedPairConf _matchedPairConf; diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index 66fefc32d..4f5542dd0 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -344,37 +344,39 @@ IDD_PREFERENCE_SUB_AUTOCOMPLETION DIALOGEX 0, 0, 455, 185 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,15,100,10 - - GROUPBOX "Auto-Completion",IDD_AUTOC_GRPSTATIC,131,4,289,84,BS_CENTER - CONTROL "Enable auto-completion on each input",IDD_AUTOC_ENABLECHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,136,15,150,10 - CONTROL "Function completion",IDD_AUTOC_FUNCRADIO,"Button",BS_AUTORADIOBUTTON | WS_GROUP,163,27,145,10 - CONTROL "Word completion",IDD_AUTOC_WORDRADIO,"Button",BS_AUTORADIOBUTTON,163,41,145,10 - CONTROL "Function and word completion",IDD_AUTOC_BOTHRADIO,"Button",BS_AUTORADIOBUTTON,163,55,145,10 - RTEXT "From",IDD_AUTOC_STATIC_FROM,293,15,47,8 - CTEXT "1",IDD_AUTOC_STATIC_N,344,15,8,8,WS_TABSTOP - LTEXT "th character",IDD_AUTOC_STATIC_CHAR,358,15,57,8 - LTEXT "Valid value : 1 - 9",IDD_AUTOC_STATIC_NOTE,323,25,93,8 - CONTROL "Ignore numbers",IDD_AUTOC_IGNORENUMBERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,323,55,80,10 - CONTROL "Function parameters hint on input",IDD_FUNC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,136,72,160,10 - GROUPBOX "Auto-Insert",IDD_AUTOCINSERT_GRPSTATIC,131,94,289,84,BS_CENTER - CONTROL " (",IDD_AUTOCPARENTHESES_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,115,24,10 - CONTROL " [",IDD_AUTOCBRACKET_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,133,24,10 - CONTROL " {",IDD_AUTOCCURLYBRACKET_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,152,24,10 - CONTROL " """,IDD_AUTOC_DOUBLEQUOTESCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,116,24,10 - CONTROL " '",IDD_AUTOC_QUOTESCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,133,24,10 - CONTROL " html/xml close tag",IDD_AUTOCTAG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,152,76,10 - RTEXT "Open",IDC_MACHEDPAIROPEN_STATIC,352,103,25,8 - LTEXT "Close",IDC_MACHEDPAIRCLOSE_STATIC,390,103,25,8 - RTEXT "Matched pair 1:",IDC_MACHEDPAIR_STATIC1,293,117,70,8 - EDITTEXT IDC_MACHEDPAIROPEN_EDIT1,365,115,14,14 - EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT1,393,115,14,14 - RTEXT "Matched pair 2:",IDC_MACHEDPAIR_STATIC2,293,137,70,8 - EDITTEXT IDC_MACHEDPAIROPEN_EDIT2,365,135,14,14 - EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT2,393,135,14,14 - RTEXT "Matched pair 3:",IDC_MACHEDPAIR_STATIC3,293,157,70,8 - EDITTEXT IDC_MACHEDPAIROPEN_EDIT3,365,155,14,14 - EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT3,393,155,14,14 + CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,347,15,100,10 + GROUPBOX "Auto-Completion",IDD_AUTOC_GRPSTATIC,33,4,289,90,BS_CENTER + CONTROL "Enable auto-completion on each input",IDD_AUTOC_ENABLECHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,15,150,10 + CONTROL "Function completion",IDD_AUTOC_FUNCRADIO,"Button",BS_AUTORADIOBUTTON | WS_GROUP,65,27,145,10 + CONTROL "Word completion",IDD_AUTOC_WORDRADIO,"Button",BS_AUTORADIOBUTTON,65,41,145,10 + CONTROL "Function and word completion",IDD_AUTOC_BOTHRADIO,"Button",BS_AUTORADIOBUTTON,65,55,145,10 + RTEXT "From",IDD_AUTOC_STATIC_FROM,195,12,47,8 + CTEXT "1",IDD_AUTOC_STATIC_N,246,12,8,8,WS_TABSTOP + LTEXT "th character",IDD_AUTOC_STATIC_CHAR,260,12,57,8 + LTEXT "Valid value : 1 - 9",IDD_AUTOC_STATIC_NOTE,225,22,93,8 + GROUPBOX "Insert Selection",IDD_AUTOC_USEKEY_GRP_STATIC,218,36,96,38,BS_CENTER + CONTROL "TAB",IDD_AUTOC_USETAB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,240,49,54,10 + CONTROL "ENTER",IDD_AUTOC_USEENTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,240,61,55,10 + CONTROL "Ignore numbers",IDD_AUTOC_IGNORENUMBERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,219,79,80,10 + CONTROL "Function parameters hint on input",IDD_FUNC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,79,160,10 + GROUPBOX "Auto-Insert",IDD_AUTOCINSERT_GRPSTATIC,33,99,289,84,BS_CENTER + CONTROL " (",IDD_AUTOCPARENTHESES_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,48,120,24,10 + CONTROL " [",IDD_AUTOCBRACKET_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,48,138,24,10 + CONTROL " {",IDD_AUTOCCURLYBRACKET_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,48,157,24,10 + CONTROL " """,IDD_AUTOC_DOUBLEQUOTESCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,121,24,10 + CONTROL " '",IDD_AUTOC_QUOTESCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,138,24,10 + CONTROL " html/xml close tag",IDD_AUTOCTAG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,157,76,10 + RTEXT "Open",IDC_MACHEDPAIROPEN_STATIC,254,108,25,8 + LTEXT "Close",IDC_MACHEDPAIRCLOSE_STATIC,292,108,25,8 + RTEXT "Matched pair 1:",IDC_MACHEDPAIR_STATIC1,195,122,70,8 + EDITTEXT IDC_MACHEDPAIROPEN_EDIT1,267,120,14,14 + EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT1,295,120,14,14 + RTEXT "Matched pair 2:",IDC_MACHEDPAIR_STATIC2,195,142,70,8 + EDITTEXT IDC_MACHEDPAIROPEN_EDIT2,267,140,14,14 + EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT2,295,140,14,14 + RTEXT "Matched pair 3:",IDC_MACHEDPAIR_STATIC3,195,162,70,8 + EDITTEXT IDC_MACHEDPAIROPEN_EDIT3,267,160,14,14 + EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT3,295,160,14,14 END diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 2d6c7fdd8..55f9296d2 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -3562,12 +3562,18 @@ INT_PTR CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam, if (nppGUI._autocStatus == nppGUI.autoc_word || nppGUI._autocStatus == nppGUI.autoc_both) ::SendDlgItemMessage(_hSelf, IDD_AUTOC_IGNORENUMBERS, BM_SETCHECK, nppGUI._autocIgnoreNumbers ? BST_CHECKED : BST_UNCHECKED, 0); + + ::SendDlgItemMessage(_hSelf, IDD_AUTOC_USEENTER, BM_SETCHECK, nppGUI._autocInsertSelectedUseENTER ? BST_CHECKED : BST_UNCHECKED, 0); + ::SendDlgItemMessage(_hSelf, IDD_AUTOC_USETAB, BM_SETCHECK, nppGUI._autocInsertSelectedUseTAB ? BST_CHECKED : BST_UNCHECKED, 0); + if (!isEnableAutoC) { ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_FUNCRADIO), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_WORDRADIO), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_BOTHRADIO), FALSE); + ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_USEENTER), FALSE); + ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_USETAB), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_IGNORENUMBERS), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_STATIC_FROM), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_STATIC_N), FALSE); @@ -3738,6 +3744,9 @@ INT_PTR CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam, ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_FUNCRADIO), isEnableAutoC); ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_WORDRADIO), isEnableAutoC); ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_BOTHRADIO), isEnableAutoC); + ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_USEKEY_GRP_STATIC), isEnableAutoC); + ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_USEENTER), isEnableAutoC); + ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_USETAB), isEnableAutoC); ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_IGNORENUMBERS), isEnableAutoC); ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_STATIC_FROM), isEnableAutoC); ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_STATIC_N), isEnableAutoC); @@ -3771,15 +3780,27 @@ INT_PTR CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam, return TRUE; } + case IDD_AUTOC_USEENTER: + { + nppGUI._autocInsertSelectedUseENTER = isCheckedOrNot(static_cast(wParam)); + return TRUE; + } + + case IDD_AUTOC_USETAB: + { + nppGUI._autocInsertSelectedUseTAB = isCheckedOrNot(static_cast(wParam)); + return TRUE; + } + case IDD_AUTOC_IGNORENUMBERS: { - nppGUI._autocIgnoreNumbers = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDD_AUTOC_IGNORENUMBERS, BM_GETCHECK, 0, 0)); + nppGUI._autocIgnoreNumbers = isCheckedOrNot(static_cast(wParam)); return TRUE; } case IDD_FUNC_CHECK : { - nppGUI._funcParams = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDD_FUNC_CHECK, BM_GETCHECK, 0, 0)); + nppGUI._funcParams = isCheckedOrNot(static_cast(wParam)); return TRUE; } @@ -3818,7 +3839,7 @@ INT_PTR CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam, case IDD_AUTOC_DOUBLEQUOTESCHECK : case IDD_AUTOC_QUOTESCHECK : { - bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast(wParam), BM_GETCHECK, 0, 0)); + bool isChecked = isCheckedOrNot(static_cast(wParam)); const TCHAR *label; if (wParam == IDD_AUTOCPARENTHESES_CHECK) { diff --git a/PowerEditor/src/WinControls/Preference/preference_rc.h b/PowerEditor/src/WinControls/Preference/preference_rc.h index cbb31aa9d..acd5b8ddf 100644 --- a/PowerEditor/src/WinControls/Preference/preference_rc.h +++ b/PowerEditor/src/WinControls/Preference/preference_rc.h @@ -371,6 +371,9 @@ #define IDC_MACHEDPAIR_STATIC3 (IDD_PREFERENCE_SUB_AUTOCOMPLETION + 16) #define IDC_MACHEDPAIROPEN_EDIT3 (IDD_PREFERENCE_SUB_AUTOCOMPLETION + 17) #define IDC_MACHEDPAIRCLOSE_EDIT3 (IDD_PREFERENCE_SUB_AUTOCOMPLETION + 18) + #define IDD_AUTOC_USEKEY_GRP_STATIC (IDD_PREFERENCE_SUB_AUTOCOMPLETION + 19) + #define IDD_AUTOC_USETAB (IDD_PREFERENCE_SUB_AUTOCOMPLETION + 20) + #define IDD_AUTOC_USEENTER (IDD_PREFERENCE_SUB_AUTOCOMPLETION + 21) #define IDD_PREFERENCE_SUB_SEARCHING 6900 //(IDD_PREFERENCE_BOX + 900) #define IDC_CHECK_STOPFILLINGFINDFIELD (IDD_PREFERENCE_SUB_SEARCHING + 1)