From 6c3ecacdb7cf3d301b4b2fc74f0770ff4bf13ab5 Mon Sep 17 00:00:00 2001 From: Don HO Date: Wed, 9 Dec 2020 16:25:35 +0100 Subject: [PATCH] Enhance localization of "Line" of Search result This enhancement translates "Line" prefix of Search resulton when user change each time the localization. Inspired from #9233 --- PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp | 8 ++++---- PowerEditor/src/ScitillaComponent/FindReplaceDlg.h | 3 ++- scintilla/lexers/LexSearchResult.cxx | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index 3ca55832..c8e281f6 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -3539,10 +3539,8 @@ void Finder::add(FoundInfo fi, SearchResultMarking mi, const TCHAR* foundline) { _pMainFoundInfos->push_back(fi); - NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); - static generic_string lineStr = pNativeSpeaker->getLocalizedStrFromID("find-result-line-prefix", TEXT("Line")); generic_string str = TEXT("\t"); - str += lineStr; + str += _prefixLineStr; str += TEXT(" "); TCHAR lnb[16]; @@ -3684,7 +3682,9 @@ void Finder::copy() void Finder::beginNewFilesSearch() { - //_scintView.execute(SCI_SETLEXER, SCLEX_NULL); + NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); + _prefixLineStr = pNativeSpeaker->getLocalizedStrFromID("find-result-line-prefix", TEXT("Line")); + _scintView.execute(SCI_SETCURRENTPOS, 0); _pMainFoundInfos = _pMainFoundInfos == &_foundInfos1 ? &_foundInfos2 : &_foundInfos1; diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h index 0b3adce9..e2343da4 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h @@ -167,9 +167,10 @@ private: int _lastSearchHeaderPos = 0; bool _canBeVolatiled = true; - bool _longLinesAreWrapped = false; + generic_string _prefixLineStr; + void setFinderReadOnly(bool isReadOnly) { _scintView.execute(SCI_SETREADONLY, isReadOnly); }; diff --git a/scintilla/lexers/LexSearchResult.cxx b/scintilla/lexers/LexSearchResult.cxx index b00adb2f..9f5b6cc9 100644 --- a/scintilla/lexers/LexSearchResult.cxx +++ b/scintilla/lexers/LexSearchResult.cxx @@ -78,7 +78,6 @@ static void ColouriseSearchResultLine(SearchResultMarkings* pMarkings, char *lin SearchResultMarking mi = pMarkings->_markings[linenum]; - currentPos += 2; // skip ": " size_t match_start = startLine + mi._start - 1; size_t match_end = startLine + mi._end - 1;