Repository navigation
Conversation
Fix notepad-plus-plus#17865, fix notepad-plus-plus#17518 Notepad++ shows a right-to-left document by mirroring its Scintilla window (WS_EX_LAYOUTRTL), and only GDI follows that mirroring: DirectWrite draws such a view left-to-right while Windows mirrors its scrollbar and mouse coordinates. RTL was refused while DirectWrite was on (a message shown once, then nothing: notepad-plus-plus#17865), and with an RTL UI language the views mirrored from the start were drawn with DirectWrite anyway, the default rendering mode. A right-to-left view is now drawn with GDI whatever the rendering mode, and gets its own technology back once left-to-right (the one it had, so a rendering mode changed in Preferences still waits for a restart, and a technology set by a plugin is kept); a view mirrored at creation gets the rendering mode once left-to-right. The refusal and its message are gone. At startup the views also get the direction of their first document: with editZoneRTL="no" they stayed mirrored (notepad-plus-plus#17518). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pyre909
added a commit
to Pyre909/notepad-plus-plus
that referenced
this pull request
Oct 16, 2026
…sted), the live switch's texts name it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Notepad++ shows an RTL document by mirroring the editor window (WS_EX_LAYOUTRTL), but only GDI drawing actually follows that mirroring. With DirectWrite the text still comes out left-to-right while Windows mirrors the scrollbar and the mouse, so clicks end up on the wrong side. Scintilla won't help here either, its maintainer said mirroring only ever worked with GDI: https://sourceforge.net/p/scintilla/feature-requests/1435/
What that looks like right now:
So this PR just draws a mirrored view with GDI, whatever the rendering mode is, and gives it back whatever it was using once it's LTR again (that includes switching between RTL and LTR tabs, and a technology a plugin set on the view). A view that starts mirrored never gets DirectWrite in the first place. The refusal and its message are gone.
While I was in there: at startup the first document gets activated while it's already the current one, so the views never got their direction set, and with editZoneRTL="no" they stayed mirrored anyway (#17518). Two lines in Notepad_plus::init fix that.
5 files, nothing in Scintilla.
Tested on Windows 11 ARM64 with Release builds of this branch, fresh config so DirectWrite is on (all 13 CI jobs pass on my fork too: MSVC x64, Win32 and ARM64 Release and Debug, CMake, MinGW, Clang): RTL/LTR back and forth, RTL and LTR tabs, an RTL doc cloned to the other view, the Document Map following along, a long wrapped doc keeping its scroll position through all of it, and the Hebrew UI from startup to exit, also with editZoneRTL="no" and no session, in both GDI (the case in #17518) and DirectWrite. No messages anywhere, and LTR documents stay on DirectWrite.
Two things I know about and left alone: with an RTL UI, a Scintilla a plugin creates is mirrored from the start like the others, so it starts on GDI too, and a plugin's SCI_SETBIDIRECTIONAL gets cleared when its view switches to GDI (that's Scintilla's doing).
AI disclosure: I wrote this with help from an AI assistant (Claude), then reviewed and tested it myself.
fix #17865, fix #17518