diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml
index c3379fb6a01..1a6db5900ac 100644
--- a/PowerEditor/installer/nativeLang/english.xml
+++ b/PowerEditor/installer/nativeLang/english.xml
@@ -1146,7 +1146,6 @@ You can define several column markers by using white space to separate the diffe
-
@@ -1615,7 +1614,6 @@ Find in all files but exclude all folders log or logs recursively:
-
diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h
index 4f6ae664234..cc9b3540107 100644
--- a/PowerEditor/src/Parameters.h
+++ b/PowerEditor/src/Parameters.h
@@ -851,7 +851,7 @@ struct NppGUI final
GlobalOverride _globalOverride;
enum AutocStatus{autoc_none, autoc_func, autoc_word, autoc_both};
AutocStatus _autocStatus = autoc_both;
- size_t _autocFromLen = 1;
+ UINT _autocFromLen = 1;
bool _autocIgnoreNumbers = true;
bool _autocInsertSelectedUseENTER = true;
bool _autocInsertSelectedUseTAB = true;
diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc
index 1922475452b..e292df8b48d 100644
--- a/PowerEditor/src/WinControls/Preference/preference.rc
+++ b/PowerEditor/src/WinControls/Preference/preference.rc
@@ -375,40 +375,46 @@ IDD_PREFERENCE_SUB_AUTOCOMPLETION DIALOGEX 115, 10, 460, 205
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,347,15,100,10
- GROUPBOX "Auto-Completion",IDD_AUTOC_GRPSTATIC,33,4,289,100,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 "Make auto-completion list brief",IDD_AUTOC_BRIEF_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,69,160,10
- CONTROL "Function parameters hint on input",IDD_FUNC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,88,160,10
- GROUPBOX "Auto-Insert",IDD_AUTOCINSERT_GRPSTATIC,33,109,289,84,BS_CENTER
- CONTROL " (",IDD_AUTOCPARENTHESES_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,48,130,24,10
- CONTROL " [",IDD_AUTOCBRACKET_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,48,148,24,10
- CONTROL " {",IDD_AUTOCCURLYBRACKET_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,48,167,24,10
- CONTROL " """,IDD_AUTOC_DOUBLEQUOTESCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,131,24,10
- CONTROL " '",IDD_AUTOC_QUOTESCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,148,24,10
- CONTROL " html/xml close tag",IDD_AUTOCTAG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,167,76,10
- RTEXT "Open",IDC_MACHEDPAIROPEN_STATIC,254,118,25,8
- LTEXT "Close",IDC_MACHEDPAIRCLOSE_STATIC,292,118,25,8
- RTEXT "Matched pair 1:",IDC_MACHEDPAIR_STATIC1,195,132,70,8
- EDITTEXT IDC_MACHEDPAIROPEN_EDIT1,267,130,14,14
- EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT1,295,130,14,14
- RTEXT "Matched pair 2:",IDC_MACHEDPAIR_STATIC2,195,152,70,8
- EDITTEXT IDC_MACHEDPAIROPEN_EDIT2,267,150,14,14
- EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT2,295,150,14,14
- RTEXT "Matched pair 3:",IDC_MACHEDPAIR_STATIC3,195,172,70,8
- EDITTEXT IDC_MACHEDPAIROPEN_EDIT3,267,170,14,14
- EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT3,295,170,14,14
+ GROUPBOX "Auto-Completion",IDD_AUTOC_GRPSTATIC,33,3,289,105,BS_CENTER
+ CONTROL "Enable auto-completion on each input",IDD_AUTOC_ENABLECHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,39,16,160,10
+ CONTROL "Function completion",IDD_AUTOC_FUNCRADIO,"Button",BS_AUTORADIOBUTTON | WS_GROUP,51,31,145,10
+ CONTROL "Word completion",IDD_AUTOC_WORDRADIO,"Button",BS_AUTORADIOBUTTON,51,46,145,10
+ CONTROL "Function and word completion",IDD_AUTOC_BOTHRADIO,"Button",BS_AUTORADIOBUTTON,51,61,145,10
+ CONTROL "Make auto-completion list brief",IDD_AUTOC_BRIEF_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,39,76,160,10
+ CONTROL "Function parameters hint on input",IDD_FUNC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,39,93,160,10
+
+ RTEXT "From",IDD_AUTOC_STATIC_FROM,195,16,47,8
+ CTEXT "1",IDD_AUTOC_STATIC_N,246,16,8,8
+ LTEXT "th character",IDD_AUTOC_STATIC_CHAR,260,16,57,8
+ CONTROL "",IDC_AUTOC_CHAR_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | TBS_TRANSPARENTBKGND | WS_TABSTOP,233,29,66,13
+ RTEXT "1",IDD_AUTOC_SLIDER_MIN_STATIC,223,30,8,8
+ LTEXT "9",IDD_AUTOC_SLIDER_MAX_STATIC,301,30,8,8
+ GROUPBOX "Insert Selection",IDD_AUTOC_USEKEY_GRP_STATIC,218,44,96,43,BS_CENTER
+ CONTROL "TAB",IDD_AUTOC_USETAB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,224,57,54,10
+ CONTROL "ENTER",IDD_AUTOC_USEENTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,224,72,55,10
+ CONTROL "Ignore numbers",IDD_AUTOC_IGNORENUMBERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,218,93,80,10
+
+ CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,347,16,100,10
+
+ GROUPBOX "Auto-Insert",IDD_AUTOCINSERT_GRPSTATIC,33,114,289,83,BS_CENTER
+ CONTROL " (",IDD_AUTOCPARENTHESES_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,50,140,24,10
+ CONTROL " [",IDD_AUTOCBRACKET_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,50,160,24,10
+ CONTROL " {",IDD_AUTOCCURLYBRACKET_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,50,180,24,10
+ CONTROL " """,IDD_AUTOC_DOUBLEQUOTESCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,140,24,10
+ CONTROL " '",IDD_AUTOC_QUOTESCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,160,24,10
+ CONTROL " html/xml close tag",IDD_AUTOCTAG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,180,76,10
+
+ RTEXT "Open",IDC_MACHEDPAIROPEN_STATIC,254,126,25,8
+ LTEXT "Close",IDC_MACHEDPAIRCLOSE_STATIC,292,126,25,8
+ RTEXT "Matched pair 1:",IDC_MACHEDPAIR_STATIC1,190,140,70,8
+ EDITTEXT IDC_MACHEDPAIROPEN_EDIT1,264,138,14,12,ES_CENTER
+ EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT1,292,138,14,12,ES_CENTER
+ RTEXT "Matched pair 2:",IDC_MACHEDPAIR_STATIC2,190,160,70,8
+ EDITTEXT IDC_MACHEDPAIROPEN_EDIT2,264,158,14,12,ES_CENTER
+ EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT2,292,158,14,12,ES_CENTER
+ RTEXT "Matched pair 3:",IDC_MACHEDPAIR_STATIC3,190,180,70,8
+ EDITTEXT IDC_MACHEDPAIROPEN_EDIT3,264,178,14,12,ES_CENTER
+ EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT3,292,178,14,12,ES_CENTER
END
diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp
index 49db936eb28..f7db00b4279 100644
--- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp
+++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp
@@ -44,6 +44,10 @@ const int DISTRACTIONFREE_SMALLEST = 3;
const int DISTRACTIONFREE_LARGEST = 9;
const int DISTRACTIONFREE_INTERVAL = 1;
+constexpr int AUTOCOMPLETEFROMCHAR_SMALLEST = 1;
+constexpr int AUTOCOMPLETEFROMCHAR_LARGEST = 9;
+constexpr int AUTOCOMPLETEFROMCHAR_INTERVAL = 1;
+
// This int encoding array is built from "EncodingUnit encodings[]" (see EncodingMapper.cpp)
// And NewDocumentSubDlg will use "int encoding array" to get more info from "EncodingUnit encodings[]"
static int encodings[] = {
@@ -4013,9 +4017,13 @@ intptr_t CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam,
{
case WM_INITDIALOG :
{
- ::SetDlgItemInt(_hSelf, IDD_AUTOC_STATIC_N, static_cast(nppGUI._autocFromLen), FALSE);
- _nbCharVal.init(_hInst, _hSelf);
- _nbCharVal.create(::GetDlgItem(_hSelf, IDD_AUTOC_STATIC_N), IDD_AUTOC_STATIC_N);
+ ::SetDlgItemInt(_hSelf, IDD_AUTOC_STATIC_N, nppGUI._autocFromLen, FALSE);
+
+ const HWND hNbCharSlider = ::GetDlgItem(_hSelf, IDC_AUTOC_CHAR_SLIDER);
+ ::SendMessage(hNbCharSlider, TBM_SETRANGEMIN, TRUE, AUTOCOMPLETEFROMCHAR_SMALLEST);
+ ::SendMessage(hNbCharSlider, TBM_SETRANGEMAX, TRUE, AUTOCOMPLETEFROMCHAR_LARGEST);
+ ::SendMessage(hNbCharSlider, TBM_SETPAGESIZE, 0, AUTOCOMPLETEFROMCHAR_INTERVAL);
+ ::SendMessage(hNbCharSlider, TBM_SETPOS, TRUE, nppGUI._autocFromLen);
bool isEnableAutoC = nppGUI._autocStatus != nppGUI.autoc_none;
@@ -4047,6 +4055,7 @@ intptr_t CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam,
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_USEENTER), FALSE);
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_USETAB), FALSE);
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_IGNORENUMBERS), FALSE);
+ ::EnableWindow(::GetDlgItem(_hSelf, IDC_AUTOC_CHAR_SLIDER), FALSE);
}
::SendDlgItemMessage(_hSelf, IDC_CHECK_MAINTAININDENT, BM_SETCHECK, nppGUI._maitainIndent, 0);
@@ -4087,10 +4096,10 @@ intptr_t CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam,
nbMatchedPair = 3;
for (size_t i = 0; i < nbMatchedPair; ++i)
{
- TCHAR openChar[2];
+ TCHAR openChar[2]{};
openChar[0] = nppGUI._matchedPairConf._matchedPairsInit[i].first;
openChar[1] = '\0';
- TCHAR closeChar[2];
+ TCHAR closeChar[2]{};
closeChar[0] = nppGUI._matchedPairConf._matchedPairsInit[i].second;
closeChar[1] = '\0';
@@ -4134,19 +4143,19 @@ intptr_t CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam,
case WM_CTLCOLORSTATIC:
{
- auto hdcStatic = reinterpret_cast(wParam);
- auto dlgCtrlID = ::GetDlgCtrlID(reinterpret_cast(lParam));
+ const auto hdcStatic = reinterpret_cast(wParam);
+ const auto dlgCtrlID = ::GetDlgCtrlID(reinterpret_cast(lParam));
- bool isStaticText = (dlgCtrlID == IDD_AUTOC_STATIC_FROM ||
+ const bool isStaticText = (dlgCtrlID == IDD_AUTOC_STATIC_FROM ||
dlgCtrlID == IDD_AUTOC_STATIC_CHAR ||
- dlgCtrlID == IDD_AUTOC_STATIC_NOTE);
+ dlgCtrlID == IDD_AUTOC_STATIC_N ||
+ dlgCtrlID == IDD_AUTOC_SLIDER_MIN_STATIC ||
+ dlgCtrlID == IDD_AUTOC_SLIDER_MAX_STATIC);
//set the static text colors to show enable/disable instead of ::EnableWindow which causes blurry text
if (isStaticText)
{
- bool isTextEnabled = isCheckedOrNot(IDD_AUTOC_ENABLECHECK);
- auto result = NppDarkMode::onCtlColorDarkerBGStaticText(hdcStatic, isTextEnabled);
- _nbCharVal.display(isTextEnabled);
- return result;
+ const bool isTextEnabled = isCheckedOrNot(IDD_AUTOC_ENABLECHECK);
+ return NppDarkMode::onCtlColorDarkerBGStaticText(hdcStatic, isTextEnabled);
}
if (NppDarkMode::isEnabled())
@@ -4165,6 +4174,18 @@ intptr_t CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam,
break;
}
+ case WM_HSCROLL:
+ {
+ const HWND hNbCharSlider = ::GetDlgItem(_hSelf, IDC_AUTOC_CHAR_SLIDER);
+ if (hNbCharSlider == reinterpret_cast(lParam))
+ {
+ nppGUI._autocFromLen = static_cast(::SendMessage(hNbCharSlider, TBM_GETPOS, 0, 0));
+ ::SetDlgItemInt(_hSelf, IDD_AUTOC_STATIC_N, nppGUI._autocFromLen, FALSE);
+ }
+
+ return 0; //return zero when handled
+ }
+
case WM_COMMAND :
{
if (HIWORD(wParam) == EN_CHANGE)
@@ -4243,6 +4264,7 @@ intptr_t CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam,
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_USEENTER), isEnableAutoC);
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_USETAB), isEnableAutoC);
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_IGNORENUMBERS), isEnableAutoC);
+ ::EnableWindow(::GetDlgItem(_hSelf, IDC_AUTOC_CHAR_SLIDER), isEnableAutoC);
redraw();
return TRUE;
@@ -4303,35 +4325,6 @@ intptr_t CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam,
nppGUI._funcParams = isCheckedOrNot(static_cast(wParam));
return TRUE;
}
-
- case IDD_AUTOC_STATIC_N :
- {
- const int NB_MIN_CHAR = 1;
- const int NB_MAX_CHAR = 9;
-
- NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker();
- generic_string strNbChar = pNativeSpeaker->getLocalizedStrFromID("autocomplete-nb-char", TEXT("Nb char : "));
-
- ValueDlg valDlg;
- valDlg.init(NULL, _hSelf, static_cast(nppGUI._autocFromLen), strNbChar.c_str());
- valDlg.setNBNumber(1);
-
- POINT p;
- ::GetCursorPos(&p);
-
- int size = valDlg.doDialog(p);
- if (size != -1)
- {
- if (size > NB_MAX_CHAR)
- size = NB_MAX_CHAR;
- else if (size < NB_MIN_CHAR)
- size = NB_MIN_CHAR;
-
- nppGUI._autocFromLen = size;
- ::SetDlgItemInt(_hSelf, IDD_AUTOC_STATIC_N, static_cast(nppGUI._autocFromLen), FALSE);
- }
- return TRUE;
- }
case IDD_AUTOCPARENTHESES_CHECK :
case IDD_AUTOCBRACKET_CHECK :
diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.h b/PowerEditor/src/WinControls/Preference/preferenceDlg.h
index d2fba202b90..25ec62bb7a1 100644
--- a/PowerEditor/src/WinControls/Preference/preferenceDlg.h
+++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.h
@@ -220,7 +220,6 @@ class AutoCompletionSubDlg : public StaticDialog
public :
AutoCompletionSubDlg() = default;
private :
- URLCtrl _nbCharVal;
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
};
diff --git a/PowerEditor/src/WinControls/Preference/preference_rc.h b/PowerEditor/src/WinControls/Preference/preference_rc.h
index 1dcaf2dffa3..bde0e3a0dab 100644
--- a/PowerEditor/src/WinControls/Preference/preference_rc.h
+++ b/PowerEditor/src/WinControls/Preference/preference_rc.h
@@ -380,7 +380,7 @@
#define IDD_AUTOC_STATIC_FROM (IDD_PREFERENCE_SUB_BACKUP + 11)
#define IDD_AUTOC_STATIC_N (IDD_PREFERENCE_SUB_BACKUP + 12)
#define IDD_AUTOC_STATIC_CHAR (IDD_PREFERENCE_SUB_BACKUP + 13)
- #define IDD_AUTOC_STATIC_NOTE (IDD_PREFERENCE_SUB_BACKUP + 14)
+ //#define IDD_AUTOC_STATIC_NOTE (IDD_PREFERENCE_SUB_BACKUP + 14)
#define IDD_FUNC_CHECK (IDD_PREFERENCE_SUB_BACKUP + 15)
#define IDD_AUTOC_BOTHRADIO (IDD_PREFERENCE_SUB_BACKUP + 16)
#define IDC_BACKUPDIR_RESTORESESSION_GRP_STATIC (IDD_PREFERENCE_SUB_BACKUP + 17)
@@ -415,6 +415,9 @@
#define IDD_AUTOC_USETAB (IDD_PREFERENCE_SUB_AUTOCOMPLETION + 20)
#define IDD_AUTOC_USEENTER (IDD_PREFERENCE_SUB_AUTOCOMPLETION + 21)
#define IDD_AUTOC_BRIEF_CHECK (IDD_PREFERENCE_SUB_AUTOCOMPLETION + 22)
+ #define IDC_AUTOC_CHAR_SLIDER (IDD_PREFERENCE_SUB_AUTOCOMPLETION + 23)
+ #define IDD_AUTOC_SLIDER_MIN_STATIC (IDD_PREFERENCE_SUB_AUTOCOMPLETION + 24)
+ #define IDD_AUTOC_SLIDER_MAX_STATIC (IDD_PREFERENCE_SUB_AUTOCOMPLETION + 25)
#define IDD_PREFERENCE_SUB_SEARCHING 6900 //(IDD_PREFERENCE_BOX + 900)
//#define IDC_CHECK_STOPFILLINGFINDFIELD (IDD_PREFERENCE_SUB_SEARCHING + 1)