Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions agent-trail/architecture/codebase-and-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Notepad3 is a Windows-only Win32 C/C++ text editor built on Scintilla/Lexilla, d

| File | Purpose |
|---|---|
| `src\Notepad3.c/h` | `wWinMain`, `MainWndProc`, global state structs (`Globals`, `Settings`, `Settings2`, `Flags`, `Paths`), and `MsgCommand()` |
| `src\Notepad3Util.c/h` | Bitmap/toolbar helpers, word-wrap configuration, middle-click auto-scroll |
| `src\Edit.c/h` | Find/replace (PCRE2), encoding, clipboard, indent, sort, bookmarks, folding, autocomplete |
| `src\Notepad3.c/h` | `wWinMain`, `MainWndProc`, global state, `MsgCommand()`, toolbar setup, word-wrap configuration, middle-click auto-scroll |
| `src\Edit.c/h` | Encoding, clipboard, indent, sort, bookmarks, folding, autocomplete, URL/color highlighting |
| `src\FindReplace.c/h` | Find/Replace dialog, search state, PCRE2-backed matching, replacement, occurrence marking |
| `src\Styles.c/h` | Scintilla styling, lexer selection, themes, margins |
| `src\Dialogs.c/h` | Dialogs and DPI-aware UI |
| `src\Config\Config.cpp/h` | INI load/save and MRU |
Expand Down Expand Up @@ -79,13 +79,13 @@ Before an approved vendored-library change, consult the [Lexilla patch registry]

### Find/Replace dialog text limits

- `CB_LIMITTEXT` (`FNDRPL_BUFFER`) does not apply to `WM_SETTEXT`; bound text before calling `ComboBox_SetText*`, or an oversized value freezes the single-line combo edit (see the `bFindReplCopySelOrClip` block in `EditFindReplaceDlgProc`, `src\Edit.c`).
- `CB_LIMITTEXT` (`FNDRPL_BUFFER`) does not apply to `WM_SETTEXT`; bound text before calling `ComboBox_SetText*`, or an oversized value freezes the single-line combo edit (see the `bFindReplCopySelOrClip` block in `EditFindReplaceDlgProc`, `src\FindReplace.c`).
- `ComboBox_SetText*` fires `CBN_EDITCHANGE` synchronously; reset one-shot flags before calling it.
- `_FindInTarget` has an 8192-byte `chFind` buffer; a longer pattern makes `WideCharToMultiByte` fail (`len` = -1) and Scintilla reports "not found".

### Find/Replace dialog placement

- For live recreation, capture the old screen rectangle and restore against its monitor. [`SetDlgPos`](../../src/Dialogs.c#L6157) is for owner-relative settings and clamps to the owner's monitor; [`_RestoreFindReplaceDlgPosition`](../../src/Edit.c#L6807) uses the old rectangle's monitor and fits the dialog again after any DPI resize.
- For live recreation, capture the old screen rectangle and restore against its monitor. [`SetDlgPos`](../../src/Dialogs.c#L6157) is for owner-relative settings and clamps to the owner's monitor; [`_RestoreFindReplaceDlgPosition`](../../src/FindReplace.c#L828) uses the old rectangle's monitor and fits the dialog again after any DPI resize.

### Dynamic string/path buffer lifetime

Expand Down
2 changes: 1 addition & 1 deletion agent-trail/open-questions.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ Add one bullet per finding: `- <area/file>: <observation> — <what would verify
- `src\Edit.c` `EditMarkAll(bMultiSel)`: one `AddSelection` per match, while `EditSelectionMultiSelectAll` uses `SCI_MULTIPLESELECTADDEACH`; converging needs `iSelectionMarkNumber` / `iMarkOccurrencesCount` derived afterwards (2026-10-29).
- `src\Edit.c` `EditWrapToColumnEx`: only caller is in `src\Notepad3.c`; whether `SCI_LINESSPLIT` (used by `EditWrapToColumn`) can replace it depends on its delimiter and tab handling — compare behaviour first (2026-10-29).
- `src\Edit.c` `EditHasTrailingBlanks`: three messages per line; a `SCI_SEARCHINTARGET` regex for `[ \t]$` might be faster — benchmark on a large file before changing (2026-10-29).
- `src\Edit.c` `_FindInTarget`: the pattern conversion is cached, while `SciCall_SetSearchFlags` and the target save/restore run on every call; the gain from splitting those into a prepare and an iterate step was not measured (2026-10-30).
- `src\FindReplace.c` `_FindInTarget`: the pattern conversion is cached, while `SciCall_SetSearchFlags` and the target save/restore run on every call; the gain from splitting those into a prepare and an iterate step was not measured (2026-10-30).
- `src\Edit.c` Scintilla-API audit, second pass (2026-10-30): read the find/replace functions, `EditSortLines`, clipboard, `EditConvertText`, URL, Base64 and hex tools and `EditModifyNumber`. No further Scintilla message replaces home-grown code there (there is no Scintilla replace-all, recode, locale sort or wildcard search). Not read: the dialog procedures (`EditFindReplaceDlgProc` and the later `*DlgProc` functions).
2 changes: 2 additions & 0 deletions other_sln/Notepad3DLL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@
<ClCompile Include="Dialogs.c" />
<ClCompile Include="Dlapi.c" />
<ClCompile Include="Edit.c" />
<ClCompile Include="FindReplace.c" />
<ClCompile Include="EditRTF.cpp" />
<ClCompile Include="Encoding.c" />
<ClCompile Include="uchardet\EncodingDetection.cpp" />
Expand Down Expand Up @@ -526,6 +527,7 @@
<ClInclude Include="Dialogs.h" />
<ClInclude Include="Dlapi.h" />
<ClInclude Include="Edit.h" />
<ClInclude Include="FindReplace.h" />
<ClInclude Include="EditRTF.h" />
<ClInclude Include="Encoding.h" />
<ClInclude Include="Helpers.h" />
Expand Down
6 changes: 6 additions & 0 deletions other_sln/Notepad3DLL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
<ClCompile Include="Edit.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="FindReplace.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="EditRTF.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -413,6 +416,9 @@
<ClInclude Include="Edit.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="FindReplace.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="EditRTF.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down
1 change: 1 addition & 0 deletions src/Config/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ extern "C" {
#include "Styles.h"
#include "Dialogs.h"
#include "Encoding.h"
#include "FindReplace.h"
#include "Notepad3.h"
#include "MuiLanguage.h"
#include "DynStrg.h"
Expand Down
Loading