From da07882fca05c641033099575396e00a18c27ccf Mon Sep 17 00:00:00 2001 From: "METANEOCORTEX\\Kotti" Date: Fri, 12 May 2023 22:12:34 +0200 Subject: [PATCH] +add: option on F/R dialog: incremental search ON/OFF --- language/common_res.h | 243 +++++++++--------- language/np3_de_de/dialogs_de_de.rc | 8 +- language/np3_en_us/dialogs_en_us.rc | 8 +- src/Config/Config.cpp | 7 + src/Edit.c | 55 ++-- src/TypeDefs.h | 3 +- .../StyleLexers/styleLexPY/hello_world.py | 33 +++ 7 files changed, 212 insertions(+), 145 deletions(-) create mode 100644 test/test_files/StyleLexers/styleLexPY/hello_world.py diff --git a/language/common_res.h b/language/common_res.h index 836f41fef..b8c2c95c8 100644 --- a/language/common_res.h +++ b/language/common_res.h @@ -343,128 +343,129 @@ #define IDC_NOWRAP 18011 #define IDC_FINDCLOSE 18012 #define IDC_ALL_OCCURRENCES 18013 -#define IDC_WILDCARDSEARCH 18014 -#define IDC_FINDPREV 18015 -#define IDC_REPLACE 18016 -#define IDC_REPLACEINSEL 18017 -#define IDC_REPLACEALL 18018 -#define IDC_SWAPSTRG 18019 -#define IDC_TOGGLEFINDREPLACE 18020 -#define IDC_BACKSLASHHELP 18021 -#define IDC_REGEXPHELP 18022 -#define IDC_WILDCARDHELP 18023 -#define IDS_FR_STATUS_TEXT 18024 -#define IDC_TOGGLE_VISIBILITY 18025 -#define IDC_OPENWITHDIR 18026 -#define IDC_GETOPENWITHDIR 18027 -#define IDC_OPENWITHDESCR 18028 -#define IDC_RESIZEGRIP 18029 -#define IDC_ENCODINGLIST 18030 -#define IDC_USEASREADINGFALLBACK 18031 -#define IDC_NOANSICPDETECTION 18032 -#define IDC_NOUNICODEDETECTION 18033 -#define IDC_ASCIIASUTF8 18034 -#define IDC_NFOASOEM 18035 -#define IDC_ENCODINGFROMFILEVARS 18036 -#define IDC_EOLMODELIST 18037 -#define IDC_WARN_INCONSISTENT_EOLS 18038 -#define IDC_CONSISTENT_EOLS 18039 +#define IDC_INST_INCR_SEARCH 18014 +#define IDC_WILDCARDSEARCH 18015 +#define IDC_FINDPREV 18016 +#define IDC_REPLACE 18017 +#define IDC_REPLACEINSEL 18018 +#define IDC_REPLACEALL 18019 +#define IDC_SWAPSTRG 18020 +#define IDC_TOGGLEFINDREPLACE 18021 +#define IDC_BACKSLASHHELP 18022 +#define IDC_REGEXPHELP 18023 +#define IDC_WILDCARDHELP 18024 +#define IDS_FR_STATUS_TEXT 18025 +#define IDC_TOGGLE_VISIBILITY 18026 +#define IDC_OPENWITHDIR 18027 +#define IDC_GETOPENWITHDIR 18028 +#define IDC_OPENWITHDESCR 18029 +#define IDC_RESIZEGRIP 18030 +#define IDC_ENCODINGLIST 18031 +#define IDC_USEASREADINGFALLBACK 18032 +#define IDC_NOANSICPDETECTION 18033 +#define IDC_NOUNICODEDETECTION 18034 +#define IDC_ASCIIASUTF8 18035 +#define IDC_NFOASOEM 18036 +#define IDC_ENCODINGFROMFILEVARS 18037 +#define IDC_EOLMODELIST 18038 +#define IDC_WARN_INCONSISTENT_EOLS 18039 +#define IDC_CONSISTENT_EOLS 18040 // keep order (CRLF(0), CR(1), LF(2)) -#define IDC_EOL_SUM_CRLF 18040 -#define IDC_EOL_SUM_CR 18041 -#define IDC_EOL_SUM_LF 18042 -#define IDC_AUTOSTRIPBLANKS 18043 -#define IDC_LINENUM 18044 -#define IDC_COLNUM 18045 -#define IDC_FILEMRU 18046 -#define IDC_PRESERVECARET 18047 -#define IDC_SAVEMRU 18048 -#define IDC_REMOVE 18049 -#define IDC_REMEMBERSEARCHPATTERN 18050 -#define IDC_AUTOLOAD_MRU_FILE 18051 -#define IDC_STYLELIST 18052 -#define IDC_DEFAULTSCHEME 18053 -#define IDC_AUTOSELECT 18054 -#define IDC_STYLELABEL_ROOT 18055 -#define IDC_STYLEEDIT_ROOT 18056 -#define IDC_STYLELABEL 18057 -#define IDC_STYLEFORE 18058 -#define IDC_STYLEBACK 18059 -#define IDC_STYLEFONT 18060 -#define IDC_PREVIEW 18061 -#define IDC_STYLEDEFAULT 18062 -#define IDC_PREVSTYLE 18063 -#define IDC_NEXTSTYLE 18064 -#define IDC_IMPORT 18065 -#define IDC_EXPORT 18066 -#define IDC_TITLE 18067 -#define IDC_STYLEEDIT 18068 -#define IDC_PRINTER 18069 -#define IDC_FAVORITESDIR 18070 -#define IDC_GETFAVORITESDIR 18071 -#define IDC_FAVORITESDESCR 18072 -#define IDC_PWD_EDIT1 18073 -#define IDC_PWD_EDIT2 18074 -#define IDC_PWD_EDIT3 18075 -#define IDC_PWD_CHECK1 18076 -#define IDC_PWD_CHECK2 18077 -#define IDC_PWD_CHECK3 18078 -#define IDC_PWD_CHECK4 18079 -#define IDC_PWD_STATMPW 18080 -#define IDC_COLUMNWRAP 18081 -#define IDC_INFOBOXTEXT 18082 -#define IDC_INFOBOXCHECK 18083 -#define IDC_INFOBOXICON 18084 -#define IDC_VERSION 18085 -#define IDC_SCI_VERSION 18086 -#define IDC_COMPILER 18087 -#define IDC_COPYRIGHT 18088 -#define IDC_WEBPAGE2 18089 -#define IDC_WEBPAGE 18090 -#define IDR_RIZBITMAP 18091 -#define IDC_RIZONEBMP 18092 -#define IDC_COPYVERSTRG 18093 -#define IDC_RICHEDITABOUT 18094 -#define IDC_TRANSL_AUTH 18095 -#define IDC_TRANSPARENT 18096 -#define IDC_TAB_WIDTH 18097 -#define IDC_INDENT_DEPTH 18098 -#define IDC_TAB_AS_SPC 18099 -#define IDC_TAB_INDENTS 18100 -#define IDC_BACKTAB_INDENTS 18101 -#define IDC_WARN_INCONSISTENT_INDENTS 18102 -#define IDC_AUTO_DETECT_INDENTS 18103 -#define IDC_CMDLINEHELP 18104 -#define IDC_STYLEEDIT_HELP 18105 -#define IDC_RELIABLE_DETECTION_RES 18106 -#define IDC_LINE_TEXT 18107 -#define IDC_COLUMN_TEXT 18108 -#define IDC_INDENT_WIDTH_TAB 18109 -#define IDC_INDENT_WIDTH_SPC 18110 -#define IDC_INDENT_SUM_TAB 18111 -#define IDC_INDENT_SUM_SPC 18112 -#define IDC_INDENT_SUM_MIX 18113 -#define IDC_INDENT_BY_TABS 18114 -#define IDC_INDENT_BY_SPCS 18115 -#define IDC_INDENT_TAB_MODX 18116 -#define IDC_INDENT_SPC_MODX 18117 -#define IDC_ADDFAV_FILES 18118 -#define IDC_INFO_GROUPBOX 18119 -#define IDC_MULTIEDGELINE 18120 -#define IDC_SHOWEDGELINE 18121 -#define IDC_BACKGRDCOLOR 18122 -#define IDC_CLEAR_LIST 18123 -#define IDC_FINDESCCTRLCHR 18124 -#define IDC_REPLESCCTRLCHR 18125 -#define IDC_AUTOSAVE_ENABLE 18126 -#define IDC_AUTOSAVE_INTERVAL 18127 -#define IDC_AUTOSAVE_SUSPEND 18128 -#define IDC_AUTOSAVE_SHUTDOWN 18129 -#define IDC_AS_BACKUP_ENABLE 18130 -#define IDC_AS_BACKUP_AUTOSAVE 18131 -#define IDC_AS_BACKUP_SIDEBYSIDE 18132 -#define IDC_AS_BACKUP_OPENFOLDER 18133 -#define IDC_FILE_CHECK_INTERVAL 18134 +#define IDC_EOL_SUM_CRLF 18041 +#define IDC_EOL_SUM_CR 18042 +#define IDC_EOL_SUM_LF 18043 +#define IDC_AUTOSTRIPBLANKS 18044 +#define IDC_LINENUM 18045 +#define IDC_COLNUM 18046 +#define IDC_FILEMRU 18047 +#define IDC_PRESERVECARET 18048 +#define IDC_SAVEMRU 18049 +#define IDC_REMOVE 18050 +#define IDC_REMEMBERSEARCHPATTERN 18051 +#define IDC_AUTOLOAD_MRU_FILE 18052 +#define IDC_STYLELIST 18053 +#define IDC_DEFAULTSCHEME 18054 +#define IDC_AUTOSELECT 18055 +#define IDC_STYLELABEL_ROOT 18056 +#define IDC_STYLEEDIT_ROOT 18057 +#define IDC_STYLELABEL 18058 +#define IDC_STYLEFORE 18059 +#define IDC_STYLEBACK 18060 +#define IDC_STYLEFONT 18061 +#define IDC_PREVIEW 18062 +#define IDC_STYLEDEFAULT 18063 +#define IDC_PREVSTYLE 18064 +#define IDC_NEXTSTYLE 18065 +#define IDC_IMPORT 18066 +#define IDC_EXPORT 18067 +#define IDC_TITLE 18068 +#define IDC_STYLEEDIT 18069 +#define IDC_PRINTER 18070 +#define IDC_FAVORITESDIR 18071 +#define IDC_GETFAVORITESDIR 18072 +#define IDC_FAVORITESDESCR 18073 +#define IDC_PWD_EDIT1 18074 +#define IDC_PWD_EDIT2 18075 +#define IDC_PWD_EDIT3 18076 +#define IDC_PWD_CHECK1 18077 +#define IDC_PWD_CHECK2 18078 +#define IDC_PWD_CHECK3 18079 +#define IDC_PWD_CHECK4 18080 +#define IDC_PWD_STATMPW 18081 +#define IDC_COLUMNWRAP 18082 +#define IDC_INFOBOXTEXT 18083 +#define IDC_INFOBOXCHECK 18084 +#define IDC_INFOBOXICON 18085 +#define IDC_VERSION 18086 +#define IDC_SCI_VERSION 18087 +#define IDC_COMPILER 18088 +#define IDC_COPYRIGHT 18089 +#define IDC_WEBPAGE2 18090 +#define IDC_WEBPAGE 18091 +#define IDR_RIZBITMAP 18092 +#define IDC_RIZONEBMP 18093 +#define IDC_COPYVERSTRG 18094 +#define IDC_RICHEDITABOUT 18095 +#define IDC_TRANSL_AUTH 18096 +#define IDC_TRANSPARENT 18097 +#define IDC_TAB_WIDTH 18098 +#define IDC_INDENT_DEPTH 18099 +#define IDC_TAB_AS_SPC 18100 +#define IDC_TAB_INDENTS 18101 +#define IDC_BACKTAB_INDENTS 18102 +#define IDC_WARN_INCONSISTENT_INDENTS 18103 +#define IDC_AUTO_DETECT_INDENTS 18104 +#define IDC_CMDLINEHELP 18105 +#define IDC_STYLEEDIT_HELP 18106 +#define IDC_RELIABLE_DETECTION_RES 18107 +#define IDC_LINE_TEXT 18108 +#define IDC_COLUMN_TEXT 18109 +#define IDC_INDENT_WIDTH_TAB 18110 +#define IDC_INDENT_WIDTH_SPC 18111 +#define IDC_INDENT_SUM_TAB 18112 +#define IDC_INDENT_SUM_SPC 18113 +#define IDC_INDENT_SUM_MIX 18114 +#define IDC_INDENT_BY_TABS 18115 +#define IDC_INDENT_BY_SPCS 18116 +#define IDC_INDENT_TAB_MODX 18117 +#define IDC_INDENT_SPC_MODX 18118 +#define IDC_ADDFAV_FILES 18119 +#define IDC_INFO_GROUPBOX 18120 +#define IDC_MULTIEDGELINE 18121 +#define IDC_SHOWEDGELINE 18122 +#define IDC_BACKGRDCOLOR 18123 +#define IDC_CLEAR_LIST 18124 +#define IDC_FINDESCCTRLCHR 18125 +#define IDC_REPLESCCTRLCHR 18126 +#define IDC_AUTOSAVE_ENABLE 18127 +#define IDC_AUTOSAVE_INTERVAL 18128 +#define IDC_AUTOSAVE_SUSPEND 18129 +#define IDC_AUTOSAVE_SHUTDOWN 18130 +#define IDC_AS_BACKUP_ENABLE 18131 +#define IDC_AS_BACKUP_AUTOSAVE 18132 +#define IDC_AS_BACKUP_SIDEBYSIDE 18133 +#define IDC_AS_BACKUP_OPENFOLDER 18134 +#define IDC_FILE_CHECK_INTERVAL 18135 #define IDC_RADIO_BTN_A 18200 #define IDC_RADIO_BTN_B 18201 diff --git a/language/np3_de_de/dialogs_de_de.rc b/language/np3_de_de/dialogs_de_de.rc index 2e1dd4ed5..8c211bec5 100644 --- a/language/np3_de_de/dialogs_de_de.rc +++ b/language/np3_de_de/dialogs_de_de.rc @@ -100,9 +100,9 @@ BEGIN CONTROL "&Kein Wrap-Around",IDC_NOWRAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,37,75,10 CONTROL "Schließe nach Fund",IDC_FINDCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,49,75,10 CONTROL "&Markiere Auftreten",IDC_ALL_OCCURRENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,61,75,10 + CONTROL "Inkrementelle Suche", IDC_INST_INCR_SEARCH, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,125,73,73,10 CONTROL "W&ildcard Suche",IDC_WILDCARDSEARCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,85,65,10 - CONTROL "Transparentes Fenster ohne Fokus",IDC_TRANSPARENT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,118,124,10 + CONTROL "Transparentes Fenster ohne Fokus",IDC_TRANSPARENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,118,124,10 DEFPUSHBUTTON "&Nächstes",IDOK,211,7,55,14 PUSHBUTTON "&Vorheriges",IDC_FINDPREV,211,24,55,14 PUSHBUTTON "Schließen",IDCANCEL,211,99,55,14 @@ -134,9 +134,9 @@ BEGIN CONTROL "&Kein Wrap-Around",IDC_NOWRAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,66,75,10 CONTROL "Schließe nach Fund",IDC_FINDCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,78,77,10 CONTROL "&Markiere Auftreten",IDC_ALL_OCCURRENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,90,73,10 + CONTROL "Inkrementelle Suche", IDC_INST_INCR_SEARCH, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,125,102,73,10 CONTROL "W&ildcard Suche",IDC_WILDCARDSEARCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,114,65,10 - CONTROL "Transparentes Fenster ohne Fokus",IDC_TRANSPARENT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,144,124,10 + CONTROL "Transparentes Fenster ohne Fokus",IDC_TRANSPARENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,144,124,10 DEFPUSHBUTTON "&Nächstes",IDOK,211,7,55,14 PUSHBUTTON "&Vorheriges",IDC_FINDPREV,211,23,55,14 PUSHBUTTON "&Ersetzen",IDC_REPLACE,211,43,55,14 diff --git a/language/np3_en_us/dialogs_en_us.rc b/language/np3_en_us/dialogs_en_us.rc index 028855f88..c7193f0b0 100644 --- a/language/np3_en_us/dialogs_en_us.rc +++ b/language/np3_en_us/dialogs_en_us.rc @@ -100,9 +100,9 @@ BEGIN CONTROL "&Don't wrap around",IDC_NOWRAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,37,75,10 CONTROL "C&lose after find",IDC_FINDCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,49,65,10 CONTROL "Mar&k Occurrences",IDC_ALL_OCCURRENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,61,73,10 + CONTROL "Incremental Search", IDC_INST_INCR_SEARCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,73,73,10 CONTROL "W&ildcard Search",IDC_WILDCARDSEARCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,85,65,10 - CONTROL "Transparent mode on losing focus",IDC_TRANSPARENT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,118,124,10 + CONTROL "Transparent mode on losing focus",IDC_TRANSPARENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,118,124,10 DEFPUSHBUTTON "&Find Next",IDOK,211,7,55,14 PUSHBUTTON "Find &Previous",IDC_FINDPREV,211,24,55,14 PUSHBUTTON "Close",IDCANCEL,211,99,55,14 @@ -134,9 +134,9 @@ BEGIN CONTROL "&Don't wrap around",IDC_NOWRAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,66,75,10 CONTROL "C&lose after replace",IDC_FINDCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,78,77,10 CONTROL "Mar&k Occurrences",IDC_ALL_OCCURRENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,90,73,10 + CONTROL "Incremental Search", IDC_INST_INCR_SEARCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,102,73,10 CONTROL "W&ildcard Search",IDC_WILDCARDSEARCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,114,65,10 - CONTROL "Transparent mode on losing focus",IDC_TRANSPARENT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,144,124,10 + CONTROL "Transparent mode on losing focus",IDC_TRANSPARENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,144,124,10 DEFPUSHBUTTON "&Find Next",IDOK,211,7,55,14 PUSHBUTTON "Find &Previous",IDC_FINDPREV,211,23,55,14 PUSHBUTTON "&Replace",IDC_REPLACE,211,43,55,14 diff --git a/src/Config/Config.cpp b/src/Config/Config.cpp index c44441b2a..9a98ed2df 100644 --- a/src/Config/Config.cpp +++ b/src/Config/Config.cpp @@ -1546,6 +1546,8 @@ void LoadSettings() Settings.EFR_Data.bWildcardSearch = IniSectionGetBool(IniSecSettings, L"WildcardSearch", Defaults.EFR_Data.bWildcardSearch); Defaults.EFR_Data.bMarkOccurences = true; Settings.EFR_Data.bMarkOccurences = IniSectionGetBool(IniSecSettings, L"FindMarkAllOccurrences", Defaults.EFR_Data.bMarkOccurences); + Defaults.EFR_Data.bInstantIncrementalSearch = true; + Settings.EFR_Data.bInstantIncrementalSearch = IniSectionGetBool(IniSecSettings, L"InstantIncrementalSearch", Defaults.EFR_Data.bInstantIncrementalSearch); Defaults.EFR_Data.bHideNonMatchedLines = false; Settings.EFR_Data.bHideNonMatchedLines = IniSectionGetBool(IniSecSettings, L"HideNonMatchedLines", Defaults.EFR_Data.bHideNonMatchedLines); Defaults.EFR_Data.fuFlags = 0; @@ -1999,6 +2001,11 @@ static bool _SaveSettings(bool bForceSaveSettings) } else { IniSectionDelete(IniSecSettings, L"FindMarkAllOccurrences", false); } + if (Settings.EFR_Data.bInstantIncrementalSearch != Defaults.EFR_Data.bInstantIncrementalSearch) { + IniSectionSetBool(IniSecSettings, L"InstantIncrementalSearch", Settings.EFR_Data.bInstantIncrementalSearch); + } else { + IniSectionDelete(IniSecSettings, L"InstantIncrementalSearch", false); + } if (Settings.EFR_Data.bHideNonMatchedLines != Defaults.EFR_Data.bHideNonMatchedLines) { IniSectionSetBool(IniSecSettings, L"HideNonMatchedLines", Settings.EFR_Data.bHideNonMatchedLines); } else { diff --git a/src/Edit.c b/src/Edit.c index 6fe57ac92..ee35437ca 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -257,6 +257,7 @@ void DuplicateEFR(LPEDITFINDREPLACE dst, CLPCEDITFINDREPLACE src) dst->bRegExprSearch = src->bRegExprSearch; dst->bWildcardSearch = src->bWildcardSearch; dst->bMarkOccurences = src->bMarkOccurences; + dst->bInstantIncrementalSearch = src->bInstantIncrementalSearch; dst->bHideNonMatchedLines = src->bHideNonMatchedLines; dst->bStateChanged = src->bStateChanged; dst->hwnd = src->hwnd; @@ -5719,6 +5720,19 @@ static void _SetSearchFlags(HWND hwnd, LPEDITFINDREPLACE lpefr) } } + bIsFlagSet = lpefr->bInstantIncrementalSearch; + if (IsButtonChecked(hwnd, IDC_INST_INCR_SEARCH)) { + if (!bIsFlagSet) { + lpefr->bInstantIncrementalSearch = true; + lpefr->bStateChanged = true; + } + } else { + if (bIsFlagSet) { + lpefr->bInstantIncrementalSearch = false; + lpefr->bStateChanged = true; + } + } + if (bIsFindDlg) { bIsFlagSet = lpefr->bFindClose; if (IsButtonChecked(hwnd, IDC_FINDCLOSE)) { @@ -6149,7 +6163,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar } int const ctl[] = { IDC_FINDCASE, IDC_FINDWORD, IDC_FINDSTART, IDC_FINDTRANSFORMBS, IDC_FINDESCCTRLCHR, IDC_REPLESCCTRLCHR, IDC_FINDREGEXP, IDC_DOT_MATCH_ALL, IDC_NOWRAP, IDC_FINDCLOSE, - IDC_ALL_OCCURRENCES, IDC_WILDCARDSEARCH, IDC_TRANSPARENT, IDC_STATIC, IDC_STATIC2 + IDC_ALL_OCCURRENCES, IDC_INST_INCR_SEARCH, IDC_WILDCARDSEARCH, IDC_TRANSPARENT, IDC_STATIC, IDC_STATIC2 }; for (int i = 0; i < COUNTOF(ctl); ++i) { SetWindowTheme(GetDlgItem(hwnd, ctl[i]), L"", L""); // remove theme for BS_AUTORADIOBUTTON @@ -6258,6 +6272,8 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar Globals.iSelectionMarkNumber = Globals.iMarkOccurrencesCount = 0; } + CheckDlgButton(hwnd, IDC_INST_INCR_SEARCH, SetBtn(s_pEfrData->bInstantIncrementalSearch)); + CheckDlgButton(hwnd, IDC_FINDCASE, SetBtn(s_pEfrData->fuFlags & SCFIND_MATCHCASE)); CheckDlgButton(hwnd, IDC_FINDWORD, SetBtn(s_pEfrData->fuFlags & SCFIND_WHOLEWORD)); CheckDlgButton(hwnd, IDC_FINDSTART, SetBtn(s_pEfrData->fuFlags & SCFIND_WORDSTART)); @@ -6627,21 +6643,25 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar LPCWSTR wchFind = _EditGetFindStrg(s_pEfrData->hwnd, s_pEfrData, false); DocPos const iPos = _FindInTarget(wchFind, (int)(s_pEfrData->fuFlags), &start, &end, false, FRMOD_NORM); - if (iPos >= 0) { - if (s_bIsReplaceDlg) { - SciCall_ScrollRange(end, iPos); - } else { - EditSetSelectionEx(end, iPos, -1, -1); + if (s_pEfrData->bInstantIncrementalSearch) { + if (iPos >= 0) { + if (s_bIsReplaceDlg) { + SciCall_ScrollRange(end, iPos); + } + else { + EditSetSelectionEx(end, iPos, -1, -1); + } + if (iPos == end) { + _ShowZeroLengthCallTip(iPos); + } } - if (iPos == end) { - _ShowZeroLengthCallTip(iPos); - } - } else { - if (s_bIsReplaceDlg) { - SciCall_ScrollRange(s_InitialAnchorPos, s_InitialCaretPos); - } - if (s_InitialTopLine >= 0) { - SciCall_SetFirstVisibleLine(s_InitialTopLine); + else { + if (s_bIsReplaceDlg) { + SciCall_ScrollRange(s_InitialAnchorPos, s_InitialCaretPos); + } + if (s_InitialTopLine >= 0) { + SciCall_SetFirstVisibleLine(s_InitialTopLine); + } } } _DelayMarkAll(_MQ_STD); @@ -6690,6 +6710,11 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar } break; + case IDC_INST_INCR_SEARCH: + _SetSearchFlags(hwnd, s_pEfrData); + _DelayMarkAll(_MQ_STD); + break; + case IDC_TOGGLE_VISIBILITY: if (s_pEfrData) { EditToggleView(s_pEfrData->hwnd); diff --git a/src/TypeDefs.h b/src/TypeDefs.h index 553dcf87b..3822fe2c5 100644 --- a/src/TypeDefs.h +++ b/src/TypeDefs.h @@ -286,6 +286,7 @@ typedef struct EDITFINDREPLACE { bool bRegExprSearch; bool bWildcardSearch; bool bMarkOccurences; + bool bInstantIncrementalSearch; bool bHideNonMatchedLines; bool bStateChanged; HWND hwnd; @@ -296,7 +297,7 @@ typedef struct EDITFINDREPLACE { typedef const EDITFINDREPLACE* const CLPCEDITFINDREPLACE; -#define INIT_EFR_DATA { 0, false, false, false, false, false, false, false, false, true, NULL, NULL, NULL } +#define INIT_EFR_DATA { 0, false, false, false, false, false, false, false, true, false, true, NULL, NULL, NULL } // USE: void DuplicateEFR(LPEDITFINDREPLACE dst, CLPCEDITFINDREPLACE src); // void ReleaseEFR(LPEDITFINDREPLACE efr); diff --git a/test/test_files/StyleLexers/styleLexPY/hello_world.py b/test/test_files/StyleLexers/styleLexPY/hello_world.py new file mode 100644 index 000000000..04009d9e0 --- /dev/null +++ b/test/test_files/StyleLexers/styleLexPY/hello_world.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# ----------------------------------------------------------------------------- +""" +Simple 'Hello world!' +""" + +# ----------------------------------------------------------------------------- + +MSG = "Hello world!" + +def main(): + """ main function """ + print(f"{MSG}") + +# ----------------------------------------------------------------------------- + +def pause(): + import os + import sys + if sys.platform == 'win32': + os.system('pause') + else: + input('Press any key to continue...') + +# ----------------------------------------------------------------------------- + +if __name__ == "__main__": + try: + main() + finally: + pause() + +# =============================================================================