From 84385e28a99113b9402c9f6dcc9d014ca1a50fdd Mon Sep 17 00:00:00 2001 From: "METANEOCORTEX\\Kotti" Date: Sat, 14 Feb 2026 01:13:14 +0100 Subject: [PATCH 1/3] upd: Lexilla v5.4.6, Scintilla v5.5.8 --- .github/copilot-instructions.md | 123 +++++++ lexilla/cppcheck.suppress | 3 +- lexilla/doc/Lexilla.html | 8 +- lexilla/doc/LexillaDownload.html | 10 +- lexilla/doc/LexillaHistory.html | 50 ++- lexilla/include/LexicalStyles.iface | 168 +++++++++ lexilla/include/SciLexer.h | 166 +++++++++ lexilla/lexers/LexHTML.cxx | 71 +--- lexilla/lexers/LexMake.cxx | 8 +- lexilla/lexers/LexPerl.cxx | 14 +- lexilla/lexlib/LexAccessor.cxx | 4 +- lexilla/lexlib/LexAccessor.h | 29 +- lexilla/scripts/LexFacer.py | 2 +- lexilla/src/Lexilla/Info.plist | 2 +- .../Lexilla/Lexilla.xcodeproj/project.pbxproj | 44 ++- lexilla/src/LexillaVersion.rc | 4 +- res/StdDarkModeScheme.ini | 1 - scintilla/Scintilla.vcxproj | 6 + scintilla/call/ScintillaCall.cxx | 8 + scintilla/cppcheck.suppress | 11 +- scintilla/doc/ScintillaDoc.html | 15 +- scintilla/doc/ScintillaDownload.html | 10 +- scintilla/doc/ScintillaHistory.html | 58 ++- scintilla/doc/index.html | 8 +- scintilla/include/Scintilla.h | 2 + scintilla/include/Scintilla.iface | 6 + scintilla/include/ScintillaCall.h | 4 +- scintilla/include/ScintillaMessages.h | 2 + scintilla/scripts/HeaderOrder.txt | 1 + scintilla/src/DBCS.cxx | 37 +- scintilla/src/DBCS.h | 6 +- scintilla/src/Document.cxx | 44 ++- scintilla/src/Document.h | 6 +- scintilla/src/EditView.cxx | 346 +++++++++--------- scintilla/src/EditView.h | 9 +- scintilla/src/Editor.cxx | 124 +++---- scintilla/src/Editor.h | 1 + scintilla/src/Geometry.h | 3 + scintilla/src/PositionCache.cxx | 9 +- scintilla/src/PositionCache.h | 3 + scintilla/src/Selection.cxx | 28 ++ scintilla/src/Selection.h | 2 + scintilla/src/Style.cxx | 6 +- scintilla/src/ViewStyle.cxx | 48 +-- scintilla/win32/ListBox.cxx | 12 +- scintilla/win32/PlatWin.cxx | 24 +- scintilla/win32/PlatWin.h | 5 + scintilla/win32/ScintRes.rc | 4 +- scintilla/win32/ScintillaWin.cxx | 70 ++-- src/StyleLexers/styleLexStandard.c | 3 +- 50 files changed, 1122 insertions(+), 506 deletions(-) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 000000000..45c2567ad --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,123 @@ +# Copilot Instructions for Notepad3 + +## Build + +Notepad3 is a Windows-only C/C++ application built with Visual Studio 2022 (toolset v145) and MSBuild. The solution file is `Notepad3.sln`. + +### Build commands + +```powershell +# Full build (all platforms: Win32, x64, x64_AVX2, ARM64) +Build\BuildAll.cmd [Release|Debug] + +# Single platform +Build\Build_x64.cmd [Release|Debug] +Build\Build_Win32.cmd [Release|Debug] +Build\Build_ARM64.cmd [Release|Debug] +Build\Build_x64_AVX2.cmd [Release|Debug] + +# MSBuild directly (used by CI) +msbuild Notepad3.sln /m /p:Configuration=Release /p:Platform=x64 + +# Clean +Build\Clean.cmd + +# NuGet restore (required before first build) +nuget restore +``` + +Default configuration is Release. The build scripts delegate to PowerShell scripts in `Build\scripts\`. + +### Versioning + +Run `Version.ps1` before building to generate `src\VersionEx.h` from templates in `Versions\`. Version format is `Major.YY.Mdd.Build` where the build number is persisted in `Versions\build.txt`. + +### Tests + +Tests live in `test\` and run via AppVeyor CI: + +```cmd +cd test +TestFileVersion.cmd # Verifies built binary version info +TestAhkNotepad3.cmd # AutoHotkey-based GUI tests (requires AutoHotkey) +``` + +### CI + +GitHub Actions workflow at `.github/workflows/build.yml` builds all four platforms (Win32, x64, x64_AVX2, ARM64) in Release on `windows-2022` runners, triggered on push/PR to master. + +## Architecture + +Notepad3 is a Win32 desktop text editor built on the **Scintilla** editing component with **Lexilla** for syntax highlighting. It ships with two companion tools: **MiniPath** (file browser) and **grepWinNP3** (file search/grep). + +### Core modules (in `src\`) + +- **Notepad3.c/h** — Application entry point (`wWinMain`), window procedure, global state structs (`GLOBALS_T`, `SETTINGS_T`, `FLAGS_T`, `PATHS_T`) +- **Edit.c/h** — Text manipulation (find/replace, encoding conversion, clipboard, indentation, sorting) +- **Styles.c/h** — Scintilla styling, lexer selection, theme management +- **Dialogs.c/h** — All dialog boxes and UI interactions +- **Encoding.c/h** — Character encoding detection and conversion +- **SciCall.h** — Type-safe inline wrappers for Scintilla direct function calls (avoids `SendMessage` overhead) +- **DynStrg.c/h** — Custom dynamic wide-string type (`HSTRINGW`) with automatic buffer management +- **PathLib.c/h** — Path manipulation via opaque `HPATHL` handle +- **TypeDefs.h** — Core type definitions (`DocPos`, `DocLn`, `cpi_enc_t`), Windows version targeting, compiler macros + +### Vendored dependencies + +- **`scintilla\`** — Scintilla editor component with Notepad3-specific patches in `np3_patches\` +- **`lexilla\`** — Lexilla syntax highlighting engine with custom patches +- **`src\uchardet\`** — Character encoding detector +- **`src\tinyexpr\` / `src\tinyexprcpp\`** — Expression evaluator for statusbar +- **`src\uthash\`** — Hash table library (C macros) +- **Boost Regex & IOStreams** — Managed via `vcpkg.json` + +### Syntax highlighting lexers (`src\StyleLexers\`) + +Each language has its own `styleLexXXX.c` file (~50+ languages). All lexers follow the `EDITLEXER` struct pattern defined in `EditLexer.h`: + +```c +EDITLEXER lexXXX = { + SCLEX_XXX, // Scintilla lexer ID + "lexerName", // Lexilla lexer name (case-sensitive) + IDS_LEX_XXX_STR, // Resource string ID + L"Config Name", // INI section name + L"ext1; ext2", // Default file extensions + L"", // Extension buffer (runtime) + &KeyWords_XXX, // Keyword lists + { /* EDITSTYLE array — must be last member */ } +}; +``` + +### Localization (`language\`) + +Resource-based MUI system with 27+ locales. Each locale has a directory `np3_LANG_COUNTRY\` containing resource `.rc` files. Language DLLs are built as separate projects in the solution. + +## Conventions + +### Code style + +- **Formatting**: LLVM-based `.clang-format` in `src\` — 4-space indentation, Stroustrup brace style, left-aligned pointers, no column limit, no include sorting +- **Editor config**: `.editorconfig` enforces UTF-8/CRLF for source files, 4-space indentation for C/C++; Lexilla code uses tabs (preserved from upstream) +- **String safety**: Uses `strsafe.h` throughout; deprecated string functions are disabled + +### Type conventions + +- Use `DocPos` / `DocPosU` / `DocLn` for Scintilla document positions and line numbers (not raw `int`) +- Use `cpi_enc_t` for encoding identifiers +- Use `HSTRINGW` and `HPATHL` (opaque handle types) instead of raw `WCHAR*` buffers for dynamic strings and paths +- `NOMINMAX` is defined globally — use `min()`/`max()` macros or typed equivalents + +### Scintilla interaction + +Always use `SciCall.h` wrappers (e.g., `SciCall_GetTextLength()`) instead of raw `SendMessage(hwnd, SCI_XXX, ...)`. The wrappers use Scintilla's direct function pointer for performance. + +### Adding a new syntax lexer + +1. Create `src\StyleLexers\styleLexNEW.c` following existing lexer patterns +2. Define `EDITLEXER` struct with lexer ID, name, extensions, keywords, and styles +3. Register it in `Styles.c` lexer array +4. Add localization string IDs to resource files + +### Global state + +Application state is centralized in global structs in `Notepad3.c` — `Globals`, `Settings`, `Settings2`, `Flags`, `Paths`. Prefer accessing these through their defined interfaces rather than adding new globals. diff --git a/lexilla/cppcheck.suppress b/lexilla/cppcheck.suppress index 21008a26b..19d8b9954 100644 --- a/lexilla/cppcheck.suppress +++ b/lexilla/cppcheck.suppress @@ -60,7 +60,6 @@ unreadVariable:lexilla/lexers/LexBaan.cxx variableScope:lexilla/lexers/LexBaan.cxx constParameterPointer:lexilla/lexers/LexBaan.cxx constParameterReference:lexilla/lexers/LexBash.cxx -knownConditionTrueFalse:lexilla/lexers/LexBash.cxx variableScope:lexilla/lexers/LexBash.cxx constVariable:lexilla/lexers/LexBasic.cxx constParameterReference:lexilla/lexers/LexBullant.cxx @@ -76,6 +75,7 @@ constParameterPointer:lexilla/lexers/LexCoffeeScript.cxx knownConditionTrueFalse:lexilla/lexers/LexCoffeeScript.cxx constVariableReference:lexilla/lexers/LexConf.cxx constParameterReference:lexilla/lexers/LexCPP.cxx +knownConditionTrueFalse:lexilla/lexers/LexCPP.cxx variableScope:lexilla/lexers/LexCSS.cxx constVariablePointer:lexilla/lexers/LexCSS.cxx knownConditionTrueFalse:lexilla/lexers/LexDataflex.cxx @@ -156,6 +156,7 @@ constParameterReference:lexilla/lexers/LexRuby.cxx constParameterReference:lexilla/lexers/LexRust.cxx knownConditionTrueFalse:lexilla/lexers/LexScriptol.cxx constParameterReference:lexilla/lexers/LexScriptol.cxx +constParameterReference:lexilla/lexers/LexSINEX.cxx constParameterPointer:lexilla/lexers/LexSmalltalk.cxx variableScope:lexilla/lexers/LexSpecman.cxx unreadVariable:lexilla/lexers/LexSpice.cxx diff --git a/lexilla/doc/Lexilla.html b/lexilla/doc/Lexilla.html index 473a17267..881e558bd 100644 --- a/lexilla/doc/Lexilla.html +++ b/lexilla/doc/Lexilla.html @@ -9,7 +9,7 @@ - +