@@ -57,7 +57,6 @@ ResultDock& ResultDock::instance()
57
57
return s;
58
58
}
59
59
60
-
61
60
std::vector<std::wstring> ResultDock::extractPaths (const std::wstring& sel)
62
61
{
63
62
std::vector<std::wstring> out;
@@ -80,7 +79,6 @@ std::vector<std::wstring> ResultDock::extractPaths(const std::wstring& sel)
80
79
return out;
81
80
}
82
81
83
-
84
82
void ResultDock::ensureCreatedAndVisible (const NppData& npp)
85
83
{
86
84
// 1) first-time creation
@@ -685,6 +683,8 @@ void ResultDock::create(const NppData& npp)
685
683
static_cast <WPARAM>(NppDarkMode::dmfInit),
686
684
reinterpret_cast<LPARAM>(_hDock));
687
685
686
+ ::SendMessage (_hSci, SCI_SETWRAPMODE, wrapEnabled() ? SC_WRAP_WORD : SC_WRAP_NONE, 0);
687
+
688
688
// 8) Initialise folding and apply syntax colours that match current N++ theme
689
689
initFolding ();
690
690
applyTheme ();
@@ -697,36 +697,32 @@ void ResultDock::initFolding() const
697
697
auto S = [this ](UINT msg, WPARAM w = 0 , LPARAM l = 0 )
698
698
{ return ::SendMessage (_hSci, msg, w, l); };
699
699
700
- /* 1) configure margin #2 for folding symbols ----------------- */
700
+ // 1) configure margin #2 for folding symbols -----------------
701
701
constexpr int M_FOLD = 2 ;
702
702
S (SCI_SETMARGINTYPEN, M_FOLD, SC_MARGIN_SYMBOL);
703
703
S (SCI_SETMARGINMASKN, M_FOLD, SC_MASK_FOLDERS);
704
704
705
- /* 2) width: 16‑px box + 4 px stem so nothing is clipped ------ */
705
+ // 2) width: 16‑px box + 4 px stem so nothing is clipped ------
706
706
const int h = static_cast <int >(S (SCI_TEXTHEIGHT));
707
707
S (SCI_SETMARGINWIDTHN, M_FOLD, h + 4 );
708
708
709
- /* 3) hide margins 0/1 (line‑numbers & bookmarks) ------------- */
709
+ // 3) hide margins 0/1 (line‑numbers & bookmarks) -------------
710
710
S (SCI_SETMARGINWIDTHN, 0 , 0 );
711
711
S (SCI_SETMARGINWIDTHN, 1 , 0 );
712
712
713
- /* -------------------------------------------------------------
714
- * 4) header markers
715
- * – root header boxes: BOXPLUS / BOXMINUS (no top stem)
716
- * – nested headers: BOXPLUSCONNECTED / …MINUS… (with stem)
717
- * ---------------------------------------------------------- */
713
+ // 4) header markers
718
714
S (SCI_MARKERDEFINE, SC_MARKNUM_FOLDER, SC_MARK_BOXPLUS);
719
715
S (SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPEN, SC_MARK_BOXMINUS);
720
716
721
717
S (SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPENMID, SC_MARK_BOXMINUSCONNECTED);
722
718
S (SCI_MARKERDEFINE, SC_MARKNUM_FOLDEREND, SC_MARK_BOXPLUSCONNECTED);
723
719
724
- /* 5) guide‑line markers (│ ├ └) ------------------------------ */
720
+ // 5) guide‑line markers (│ ├ └) ------------------------------
725
721
S (SCI_MARKERDEFINE, SC_MARKNUM_FOLDERSUB, SC_MARK_VLINE);
726
722
S (SCI_MARKERDEFINE, SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNER);
727
723
S (SCI_MARKERDEFINE, SC_MARKNUM_FOLDERTAIL, SC_MARK_LCORNER);
728
724
729
- /* 6) placeholder colour – themed colours set in applyTheme() */
725
+ // 6) placeholder colour – themed colours set in applyTheme()
730
726
constexpr COLORREF placeholder = RGB (200 , 200 , 200 );
731
727
for (int id : {
732
728
SC_MARKNUM_FOLDER,
@@ -740,10 +736,9 @@ void ResultDock::initFolding() const
740
736
S (SCI_MARKERSETBACK, id, placeholder);
741
737
}
742
738
743
- /* 7) enable mouse interaction & auto‑fold updates ------------ */
739
+ // 7) enable mouse interaction & auto‑fold updates ------------
744
740
S (SCI_SETMARGINSENSITIVEN, M_FOLD, TRUE );
745
- S (SCI_SETAUTOMATICFOLD,
746
- SC_AUTOMATICFOLD_CLICK );
741
+ S (SCI_SETAUTOMATICFOLD, SC_AUTOMATICFOLD_CLICK );
747
742
748
743
S (SCI_SETFOLDFLAGS, SC_FOLDFLAG_LINEAFTER_CONTRACTED);
749
744
@@ -965,20 +960,16 @@ LRESULT CALLBACK ResultDock::sciSubclassProc(HWND hwnd, UINT msg, WPARAM wp, LPA
965
960
extern NppData nppData;
966
961
const std::string marker = " Line " ;
967
962
968
- switch (msg)
969
- {
970
- case WM_NOTIFY:
971
- {
963
+ switch (msg) {
964
+ case WM_NOTIFY: {
972
965
NMHDR* hdr = reinterpret_cast <NMHDR*>(lp);
973
- if (hdr->code == DMN_CLOSE)
974
- {
966
+ if (hdr->code == DMN_CLOSE) {
975
967
::SendMessage (nppData._nppHandle, NPPM_DMMHIDE, 0 , reinterpret_cast <LPARAM>(hwnd));
976
968
return TRUE ;
977
969
}
978
970
979
971
SCNotification* scn = reinterpret_cast <SCNotification*>(lp);
980
- if (scn->nmhdr .code == SCN_MARGINCLICK && scn->margin == 2 )
981
- {
972
+ if (scn->nmhdr .code == SCN_MARGINCLICK && scn->margin == 2 ) {
982
973
int line = (int )::SendMessage (hwnd, SCI_LINEFROMPOSITION, scn->position , 0 );
983
974
::SendMessage (hwnd, SCI_TOGGLEFOLD, line, 0 );
984
975
return 0 ;
@@ -1001,8 +992,7 @@ LRESULT CALLBACK ResultDock::sciSubclassProc(HWND hwnd, UINT msg, WPARAM wp, LPA
1001
992
1002
993
// --- Toggle fold if the clicked line is a header ----------
1003
994
int level = (int )::SendMessage (hwnd, SCI_GETFOLDLEVEL, dispLine, 0 );
1004
- if (level & SC_FOLDLEVELHEADERFLAG)
1005
- {
995
+ if (level & SC_FOLDLEVELHEADERFLAG) {
1006
996
::SendMessage (hwnd, SCI_TOGGLEFOLD, dispLine, 0 );
1007
997
// --- remove double‑click word selection & keep scroll ----------
1008
998
Sci_Position linePos = (Sci_Position)::SendMessage (
@@ -1025,8 +1015,7 @@ LRESULT CALLBACK ResultDock::sciSubclassProc(HWND hwnd, UINT msg, WPARAM wp, LPA
1025
1015
1026
1016
// 5) Count *all* previous "Line " occurrences to get our hitIndex
1027
1017
int hitIndex = -1 ;
1028
- for (int i = 0 ; i <= dispLine; ++i)
1029
- {
1018
+ for (int i = 0 ; i <= dispLine; ++i) {
1030
1019
int len = (int )::SendMessage (hwnd, SCI_LINELENGTH, i, 0 );
1031
1020
std::string buf (len, ' \0 ' );
1032
1021
::SendMessage (hwnd, SCI_GETLINE, i, (LPARAM)&buf[0]);
@@ -1045,8 +1034,7 @@ LRESULT CALLBACK ResultDock::sciSubclassProc(HWND hwnd, UINT msg, WPARAM wp, LPA
1045
1034
int wlen = ::MultiByteToWideChar (CP_UTF8, 0 ,
1046
1035
hit.fullPathUtf8 .c_str (), -1 ,
1047
1036
nullptr , 0 );
1048
- if (wlen > 0 )
1049
- {
1037
+ if (wlen > 0 ) {
1050
1038
wpath.resize (wlen - 1 );
1051
1039
::MultiByteToWideChar (CP_UTF8, 0 , hit.fullPathUtf8.c_str(), -1, &wpath[0], wlen);
1052
1040
}
@@ -1229,9 +1217,6 @@ LRESULT CALLBACK ResultDock::sciSubclassProc(HWND hwnd, UINT msg, WPARAM wp, LPA
1229
1217
// ResultDock – Menu actions (copy / open lines & paths) – C++17
1230
1218
// ==========================================================================
1231
1219
1232
- bool ResultDock::_wrapEnabled = false ;
1233
- bool ResultDock::_purgeOnNextSearch = false ;
1234
-
1235
1220
namespace {
1236
1221
1237
1222
// --------------------------------------------------------------------------
0 commit comments