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
45 changes: 44 additions & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ GitHub Actions workflow at `.github/workflows/build.yml` builds all four platfor

## Architecture

Notepad3 is a Win32 desktop text editor built on the **Scintilla** editing component with **Lexilla** for syntax highlighting. It ships with the companion tool **MiniPath** (file browser) and integrates with the external **grepWin** tool (file search/grep).
Notepad3 is a Win32 desktop text editor built on the **Scintilla** editing component with **Lexilla** for syntax highlighting. It ships with the companion tool **MiniPath** (file browser) and integrates with the external **grepWin** tool (file search/grep) via pre-built portable executables.

### Core modules (in `src\`)

Expand All @@ -75,6 +75,22 @@ Notepad3 is a Win32 desktop text editor built on the **Scintilla** editing compo
- **`src\uthash\`** — Hash table library (C macros)
- **`src\crypto\`** — Rijndael/SHA-256 for AES-256 encryption

### grepWin Integration (`grepWin\`)

grepWin is an **external** file search/grep tool — it is **not** built from source as part of Notepad3. Pre-built portable executables and translation files are stored in the repository:

- **`grepWin\portables\`** — `grepWin-x86_portable.exe`, `grepWin-x64_portable.exe`, `LICENSE.txt`
- **`grepWin\translations\`** — `*.lang` translation files (e.g. `German.lang`, `French.lang`)

At runtime (`src\Dialogs.c`), Notepad3 searches for grepWin in this order:
1. `Settings2.GrepWinPath` (user-configured INI setting)
2. `<ModuleDirectory>\grepWin\grepWin-x64_portable.exe` (or x86) — portable layout
3. `%APPDATA%\Rizonesoft\Notepad3\grepWin\` — installed layout

Language mapping (`src\MuiLanguage.c`): `grepWinLangResName[]` maps Notepad3 locale names (e.g. `de-DE`) to grepWin `.lang` filenames (e.g. `German.lang`). The language file path is written to `grepwin.ini` before launching.

Portable build scripts (`Build\make_portable_*.cmd`) package grepWin into a `grepWin\` subdirectory in the archive containing both portable executables, the license, and all `*.lang` translations.

### 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`:
Expand Down Expand Up @@ -138,6 +154,33 @@ URL hotspot regex is defined at `src\Edit.c:108` (`HYPLNK_REGEX_FULL` macro). It

Windows 10/11 dark mode via IAT (Import Address Table) hooks. Includes stub DLLs for uxtheme and user32.

### ARM64 Platform Considerations

**Supported platforms**: Win32 (x86), x64, x64_AVX2, ARM64. ARM 32-bit is **not** supported (the `Release|ARM` solution config maps to Win32).

#### Architecture detection

Use `#if defined(_M_ARM64)` or the helper macro `NP3_BUILD_ARM64` (defined in `src\TypeDefs.h`) for ARM64-specific code paths. **Important**: both ARM64 and x64 define `_WIN64`, so use `_M_ARM64` when you need to distinguish ARM64 from x64.

#### ARM64 rendering defaults

ARM64 defaults to `SC_TECHNOLOGY_DIRECTWRITERETAIN` (value 2) instead of `SC_TECHNOLOGY_DIRECTWRITE` (value 1) to preserve the Direct2D back buffer between frames. This avoids flickering on Qualcomm Adreno GPUs and the Win11 25H2 DWM compositor. The main window also uses `WS_EX_COMPOSITED` on ARM64 for system-level double-buffering. Users can override via `RenderingTechnology` in the INI file or the View menu.

#### ARM64 build configuration

- `CETCompat` must be `false` for ARM64 (CET is x86/x64 only)
- `TargetMachine` must be `MachineARM64` in all ARM64 linker sections
- `_WIN64` must be defined in preprocessor definitions for all ARM64 configurations
- Build fix scripts in `Build\scripts\`: `FixARM64CETCompat.ps1`, `FixARM64CrossCompile.ps1`, `FixARM64OutDir.ps1`

#### GrepWin on ARM64

No native ARM64 grepWin build exists. The ARM64 build uses `grepWin-x64_portable.exe` which runs via x64 emulation on Windows ARM64. The binary selection in `src\Notepad3.c` uses `#if defined(_M_ARM64)` to handle this explicitly.

#### Theme change flickering prevention

`MsgThemeChanged()` in `src\Notepad3.c` wraps all heavy operations (bar recreation, lexer reset, restyling) in `WM_SETREDRAW FALSE/TRUE` to suppress intermediate repaints and performs a single `RedrawWindow()` at the end. DarkMode `RedrawWindow()` calls in `ListViewUtil.hpp` omit `RDW_ERASE` to avoid background erase flashes during theme transitions.

## Conventions

### Code style
Expand Down
10 changes: 9 additions & 1 deletion Build/Notepad3.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
SettingsVersion=5
;AnalyzeReliableConfidenceLevel=50
[Settings2]
;grepWin.exe=grepWinNP3.exe
;grepWin.exe=%PORTABLEAPPS_DIR%\grepWinPortable\grepWinPortable.exe
;IMEInteraction=0
;DateTimeFormat= ;(-> <Locale dependent short format>)
;DateTimeLongFormat= ;(-> <Locale dependent long format>)
Expand Down Expand Up @@ -35,6 +35,14 @@ SettingsVersion=5
;RelativeFileMRU=1
;ReuseWindow=0
;SaveBlankNewFile=true
;RenderingTechnology=1
; Scintilla Rendering Technology:
; 0 = GDI (default Win32 rendering)
; 1 = DirectWrite (default) - Direct2D
; 2 = DirectWriteRetain (preserves back buffer, default on ARM64)
; 3 = DirectWriteDC (DC-based Direct2D)
; Tip: On ARM64 with rendering issues, try 0 (GDI) or 3 (DirectWriteDC)
; Per-resolution override in [Window]: e.g. 1920x1080 RenderingTechnology=0
;SciFontQuality=3
;SimpleIndentGuides=0
;SingleFileInstance=1
Expand Down
8 changes: 8 additions & 0 deletions Build/Notepad3_pap.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ grepWin.exe=%PORTABLEAPPS_DIR%\grepWinPortable\grepWinPortable.exe
;RelativeFileMRU=1
;ReuseWindow=0
;SaveBlankNewFile=true
;RenderingTechnology=1
; Scintilla Rendering Technology:
; 0 = GDI (default Win32 rendering)
; 1 = DirectWrite (default) - Direct2D
; 2 = DirectWriteRetain (preserves back buffer, default on ARM64)
; 3 = DirectWriteDC (DC-based Direct2D)
; Tip: On ARM64 with rendering issues, try 0 (GDI) or 3 (DirectWriteDC)
; Per-resolution override in [Window]: e.g. 1920x1080 RenderingTechnology=0
;SciFontQuality=3
;SimpleIndentGuides=0
;SingleFileInstance=1
Expand Down
45 changes: 43 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## Project Overview

Notepad3 is a Windows-only Win32 desktop text editor (C/C++) built on **Scintilla** (editing component) and **Lexilla** (syntax highlighting). It ships with the companion tool **MiniPath** (file browser, Ctrl+M) and integrates with the external **grepWin** tool (file search/grep, Ctrl+Shift+F). Licensed under BSD 3-Clause.
Notepad3 is a Windows-only Win32 desktop text editor (C/C++) built on **Scintilla** (editing component) and **Lexilla** (syntax highlighting). It ships with the companion tool **MiniPath** (file browser, Ctrl+M) and integrates with the external **grepWin** tool (file search/grep, Ctrl+Shift+F) via pre-built portable executables. Licensed under BSD 3-Clause.

## Build Commands

Expand Down Expand Up @@ -85,6 +85,22 @@ MainWndProc (Notepad3.c)
| `src\uthash\` | uthash | Hash table / dynamic array macros |
| `src\crypto\` | Rijndael/SHA-256 | AES-256 encryption |

### grepWin Integration (`grepWin\`)

grepWin is an **external** file search/grep tool — it is **not** built from source as part of Notepad3. Pre-built portable executables and translation files are stored in the repository:

- **`grepWin\portables\`** — `grepWin-x86_portable.exe`, `grepWin-x64_portable.exe`, `LICENSE.txt`
- **`grepWin\translations\`** — `*.lang` translation files (e.g. `German.lang`, `French.lang`)

At runtime (`src\Dialogs.c`), Notepad3 searches for grepWin in this order:
1. `Settings2.GrepWinPath` (user-configured INI setting)
2. `<ModuleDirectory>\grepWin\grepWin-x64_portable.exe` (or x86) — portable layout
3. `%APPDATA%\Rizonesoft\Notepad3\grepWin\` — installed layout

Language mapping (`src\MuiLanguage.c`): `grepWinLangResName[]` maps Notepad3 locale names (e.g. `de-DE`) to grepWin `.lang` filenames (e.g. `German.lang`). The language file path is written to `grepwin.ini` before launching.

Portable build scripts (`Build\make_portable_*.cmd`) package grepWin into a `grepWin\` subdirectory in the archive containing both portable executables, the license, and all `*.lang` translations.

### Syntax Lexers (`src\StyleLexers\`)

50+ languages, each in a `styleLexXXX.c` file. All follow the `EDITLEXER` struct pattern from `EditLexer.h`:
Expand Down Expand Up @@ -190,7 +206,32 @@ URL hotspot regex is defined at `src\Edit.c:108` (`HYPLNK_REGEX_FULL` macro). It

Windows 10/11 dark mode via IAT (Import Address Table) hooks. Includes stub DLLs for uxtheme and user32.

## Code Conventions
### ARM64 Platform Considerations

**Supported platforms**: Win32 (x86), x64, x64_AVX2, ARM64. ARM 32-bit is **not** supported (the `Release|ARM` solution config maps to Win32).

#### Architecture detection

Use `#if defined(_M_ARM64)` or the helper macro `NP3_BUILD_ARM64` (defined in `src\TypeDefs.h`) for ARM64-specific code paths. **Important**: both ARM64 and x64 define `_WIN64`, so use `_M_ARM64` when you need to distinguish ARM64 from x64.

#### ARM64 rendering defaults

ARM64 defaults to `SC_TECHNOLOGY_DIRECTWRITERETAIN` (value 2) instead of `SC_TECHNOLOGY_DIRECTWRITE` (value 1) to preserve the Direct2D back buffer between frames. This avoids flickering on Qualcomm Adreno GPUs and the Win11 25H2 DWM compositor. The main window also uses `WS_EX_COMPOSITED` on ARM64 for system-level double-buffering. Users can override via `RenderingTechnology` in the INI file or the View menu.

#### ARM64 build configuration

- `CETCompat` must be `false` for ARM64 (CET is x86/x64 only)
- `TargetMachine` must be `MachineARM64` in all ARM64 linker sections
- `_WIN64` must be defined in preprocessor definitions for all ARM64 configurations
- Build fix scripts in `Build\scripts\`: `FixARM64CETCompat.ps1`, `FixARM64CrossCompile.ps1`, `FixARM64OutDir.ps1`

#### GrepWin on ARM64

No native ARM64 grepWin build exists. The ARM64 build uses `grepWin-x64_portable.exe` which runs via x64 emulation on Windows ARM64. The binary selection in `src\Notepad3.c` uses `#if defined(_M_ARM64)` to handle this explicitly.

#### Theme change flickering prevention

`MsgThemeChanged()` in `src\Notepad3.c` wraps all heavy operations (bar recreation, lexer reset, restyling) in `WM_SETREDRAW FALSE/TRUE` to suppress intermediate repaints and performs a single `RedrawWindow()` at the end. DarkMode `RedrawWindow()` calls in `ListViewUtil.hpp` omit `RDW_ERASE` to avoid background erase flashes during theme transitions.

### Formatting

Expand Down
2 changes: 1 addition & 1 deletion License.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ GNU General Public License v3.0, All Rights Reserved.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses>.

"grepWin" is developed by Stefan Kung (https://tools.stefankueng.com/grepWin.html).
"grepWin" is developed by Stefan Küng (https://tools.stefankueng.com/grepWin.html).

Original "grepWin" binaries and corresponding source code (according GPL to v3.0)
can be retrived at folowing location https://github.com/stefankueng/grepWin/releases/.
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Over 55 languages supported, including:
- **Portable design** — runs from USB drives with relative path storage

### Search
- **grepWinNP3** — integrated search-in-files tool with regex support (**Ctrl+Shift+F**)
- **grepWin** — integrated search-in-files tool with regex support (**Ctrl+Shift+F**)
- **Hyperlink hotspot highlighting** — Ctrl+Click to open in browser, Alt+Click to load in editor

### User Interface
Expand All @@ -66,7 +66,7 @@ Over 55 languages supported, including:

### Companion Tools
- **[MiniPath](minipath/)** — fast file browser plugin (Ctrl+M)
- **[grepWinNP3](grepWinNP3/)** — powerful search-and-replace across files
- **[grepWin](grepWin/)** — powerful search-and-replace across files

## System Requirements

Expand Down
23 changes: 15 additions & 8 deletions Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Development:
Contributors:
-------------
Derick Payne (© Rizonesoft) https://rizonesoft.com
Pairi Daiza (MUI language support) https://github.com/hpwamr
XhmikosR (Notepad2-mod) https://xhmikosr.github.io/notepad2-mod
Kai Liu (CodeFolding) https://code.kliu.org/misc/notepad2
RL Vision (Bookmarks) https://www.rlvision.com/notepad2/about.php
Expand All @@ -83,24 +84,29 @@ Some Icons by Pixel perfect (Flaticon) https://www.flaticon.com
--------------------------------------------------------------------------------
Open Source / Libraries:
------------------------
N.Hodgson (Scintilla) https://www.scintilla.org
K.Kosako (Oniguruma Regex) https://github.com/kkos/oniguruma
Stefan Küng (grepWin) https://github.com/stefankueng/grepWin
D.Dyer (NotepadCrypt) https://www.real-me.net/ddyer/notepad/NotepadCrypt.html
T.D.Hanson (uthash) https://troydhanson.github.io/uthash
Carbo Kuo (Mozilla's uchardet) https://www.freedesktop.org/wiki/Software/uchardet
Lewis Van Winkle (TinyExpr) https://github.com/codeplea/tinyexpr
Neil Hodgson (Scintilla) https://www.scintilla.org
Neil Hodgson (Lexilla) https://www.scintilla.org/Lexilla.html
Philip Hazel et al. (PCRE2 Regex) https://pcre2project.github.io/pcre2
Stefan Küng (grepWin) https://github.com/stefankueng/grepWin
D.Dyer (NotepadCrypt) https://www.real-me.net/ddyer/notepad/NotepadCrypt.html
Brodie Thiesfield (SimpleIni) https://github.com/brofield/simpleini
T.D.Hanson (uthash) https://troydhanson.github.io/uthash
Carbo Kuo (Mozilla's uchardet) https://www.freedesktop.org/wiki/Software/uchardet
Lewis Van Winkle (TinyExpr) https://github.com/codeplea/tinyexpr
Carlo Pallini (Resample BMP) https://www.codeproject.com/Articles/22271/Plain-C-Resampling-DLL

--------------------------------------------------------------------------------
Acknowledgments:
----------------
alex-ilin https://github.com/alex-ilin
alexantr https://github.com/alexantr
ashish12phnx https://github.com/ashish12phnx
bovirus https://github.com/bovirus
bravo-hero https://github.com/bravo-hero
chuanliwen https://github.com/chuanliwen
craigo- https://github.com/craigo-
Crane70 https://github.com/Crane70
en2sv https://github.com/en2sv
engelhro https://github.com/engelhro
Hexaae https://github.com/Hexaae
hpwamr https://github.com/hpwamr
Expand All @@ -122,6 +128,7 @@ MelchiorGaspar https://github.com/MelchiorGaspar
Mitezuss https://github.com/Mitezuss
nickreserved https://github.com/nickreserved
np3fan https://github.com/np3fan
p0k33m0n https://github.com/p0k33m0n
quadratz https://github.com/quadratz
RaiKoHoff https://github.com/RaiKoHoff
rizonesoft https://github.com/rizonesoft
Expand All @@ -144,7 +151,7 @@ Data Sharing Service https://workupload.com
Licences:
---------
Scintilla https://www.scintilla.org/License.txt
Oniguruma Regex https://github.com/kkos/oniguruma/blob/master/COPYING
PCRE2 Regex https://github.com/PCRE2Project/pcre2/blob/main/LICENCE.md
grepWin https://github.com/stefankueng/grepWin/blob/master/LICENSE
uthash https://troydhanson.github.io/uthash/license.html
uchardet https://www.freedesktop.org/wiki/Software/uchardet/#license
Expand Down
2 changes: 0 additions & 2 deletions grepWin/portables/website.url

This file was deleted.

28 changes: 1 addition & 27 deletions language/Line numbers to translate.txt
Original file line number Diff line number Diff line change
@@ -1,37 +1,11 @@
======================================================================================================
== ==
== This file is intended for the "Translators" to communicate to them the "Line Numbers" of ==
== the "Added or Modified" lines in "Resource" files ("filename_xx_yy.rc" and "grepWinNP3.lang"). ==
== the "Added or Modified" lines in "Resource" files ("filename_xx_yy.rc" and "grepWin.lang"). ==
== ==
== Last update: 2026-03-06 ==
======================================================================================================

January 2024: Line numbers to translate_2024-01 - No "Added or Modified" items in January 2024
Februar 2024: Line numbers to translate_2024-02 - No "Added or Modified" items in February 2024
March 2024: Line numbers to translate_2024-03 - No "Added or Modified" items in March 2024
April 2024: Line numbers to translate_2024-04 - No "Added or Modified" items in April 2024
May 2024: Line numbers to translate_2024-05 - https://workupload.com/file/gTG3tx8xeDn (2024-05-31)
June 2024: Line numbers to translate_2024-06 - No "Added or Modified" items in June 2024
July 2024: Line numbers to translate_2024-07 - https://workupload.com/file/CrBAXqPmbRp (2024-07-03)
August 2024: Line numbers to translate_2024-08 - https://workupload.com/file/QMEYR9fNhvc (2024-08-24)
Septemb 2024: Line numbers to translate_2024-09 - No "Added or Modified" items in September 2024
October 2024: Line numbers to translate_2024-10 - No "Added or Modified" items in October 2024
Novemb. 2024: Line numbers to translate_2024-11 - https://workupload.com/file/3ZUjcxrZv9p (2024-11-13)
Decemb. 2024: Line numbers to translate_2024-12 - No "Added or Modified" items in December 2024

January 2025: Line numbers to translate_2025-01 - No "Added or Modified" items in January 2025
Februar 2025: Line numbers to translate_2025-02 - No "Added or Modified" items in February 2025
March 2025: Line numbers to translate_2025-03 - No "Added or Modified" items in March 2025
April 2025: Line numbers to translate_2025-04 - No "Added or Modified" items in April 2025
May 2025: Line numbers to translate_2025-05 - No "Added or Modified" items in May 2025
June 2025: Line numbers to translate_2025-06 - No "Added or Modified" items in June 2025
July 2025: Line numbers to translate_2025-07 - No "Added or Modified" items in July 2025
August 2025: Line numbers to translate_2025-08 - No "Added or Modified" items in August 2025
Septemb 2025: Line numbers to translate_2025-09 - No "Added or Modified" items in September 2025
October 2025: Line numbers to translate_2025-10 - No "Added or Modified" items in October 2025
Novemb. 2025: Line numbers to translate_2025-11 - No "Added or Modified" items in November 2025
Decemb. 2025: Line numbers to translate_2025-12 - No "Added or Modified" items in December 2025

January 2026: Line numbers to translate_2026-01 - No "Added or Modified" items in January 2026
Februar 2026: Line numbers to translate_2026-02 - No "Added or Modified" items in February 2026
March 2026: Line numbers to translate_2026-03 - https://workupload.com/file/uDjfcJwACXx (2026-03-06)
Expand Down
Loading
Loading