The New Windows 11 Notepad app


  • Staff
The new Windows 11 Notepad uses RichEdit and runs on up-to-date Windows 11 installations. In addition to a Windows 11 look with rounded corners and a dark-theme option, the new Notepad includes several standard RichEdit editing enhancements, such as Alt+x for entering Unicode characters, Ctrl+} for toggling between matching brackets/parentheses, multilevel undo, drag & drop, color emoji, and autoURL detection. You might guess that using a RichEdit plain-text control in Notepad would be a slam dunk. RichEdit has had plain-text controls ever since Office 97 (last century!) and they’ve been used myriad times. But those plain-text controls have been small and typically exist in dialog boxes. Notepad is often used to view large files, so high performance is important, and lines can be crazy long. And classic Notepad has been improved in various ways, such as better performance, line-ending detection (CR, LF, CRLF), and a “Show Unicode control characters” context-menu option. Accordingly, it’s taken significant effort to use RichEdit as the new Notepad’s editing engine. This post describes some additions and implementation details.

Additions to RichEdit​

The classic Notepad has two handy features that weren’t implemented in RichEdit: line-ending detection (CR, LF, CRLF) and the “Show Unicode control characters” mode (discussed next). For years Notepad didn’t break Unix-convention lines that terminated with a LF (U+000A) instead of a CRLF (U+000D U+000A). I used to open the Unicode Character Data files, which contain LF-terminated lines, with WordPad and save them to convert the LF’s to CRLF’s so that Notepad would display them correctly. To fix this problem, Notepad went one better: it checked to see which line ending came first and then made that line ending the default for the file. So, a file with LF- terminated lines remains LF terminated and displayed correctly. Internally RichEdit follows the lead of Word and the Mac in terminating paragraphs with a CR and converting LF’s and CRLF’s to CR when reading in a file or storing text via an API like WM_SETTEXT or ITextRange2::SetText2. This is still the case, but you can tell RichEdit to recognize the kind of line termination in a file and use that choice for saving/copying the file by sending the EM_SETENDOFLINE message with wparam = EC_ENDOFLINE_DETECTFROMCONTENT.

Show Unicode control characters mode and emoji​

Notepad has had a “Show Unicode control characters” option in its context menu for many years. This mode displays Bidi zero-width control characters using distinctive “zero-width” glyphs. This is very valuable, for example, in revealing the Bidi RLO (U+202E) and LRO (U+202D) codes that override the usual character directionalities and are sometimes used to spoof files for nefarious purposes. It also displays the zero-width joiner (ZWJ—U+200D) with a “zero-width” vertical line topped by an x. But inside emoji ZWJ sequences, such as family emojis, the mode doesn’t break the sequence apart at the ZWJ’s and doesn’t reveal the ZWJ’s by the zero-width ZWJ glyph. And classic Notepad doesn’t display ZWJ sequences and emoji in general in color.

In the new Notepad “Show Unicode control characters” mode, ZWJ sequences are broken apart at the ZWJ’s and the ZWJ’s are displayed by the ZWJ zero-width glyph. You can navigate inside the ZWJ sequence using the ← and → keys and type Alt+x to see the codes of the characters comprising the ZWJ sequence. This lets you figure out how a ZWJ sequence is constructed. For example, the new mode displays the family emoji ZWJ sequence👨❤️👩given by the codes U+1F468 ZWJ U+2764 U+FE0F ZWJ U+1F469 as

Image FamilyEmoji

Find/Replace dialog drop down​

Visual Studio Code has a nifty Find/Replace dialog that drops down into the upper right of the text area. In case the dialog overlaps the starting text, the user can drag the text down just under the bottom of the dialog. The new Notepad mimics this behavior. It was a bit tricky to get RichEdit to provide the associated functionality. In rich-text formatting, the paragraph space-before and space-after properties are used to add spacing between paragraphs. Since RichEdit is a rich-text editor, it supports these properties, and it was natural to implement the drop-down space as “document space before”. The space-before value is included in the ascent of the first line in the document. The tricks came in dealing with deleting or replacing the first line and in scrolling the display correctly with a nonzero document-space-before value.

Plain-text UI improvements​

We decided to match the Visual-Studio UI for selecting and not selecting the EOP character at the end of a line. This differs from Word’s UI, which tends to auto select the EOP character if you navigate next to it. Specifically, in plain-text controls, we don’t let the mouse extend the selection to include the EOP on a line or let Shift+End select the EOP. This corresponds to what gets deleted if you hit the Delete key after selecting the text. You can still select the EOP character by using Shift+→ and by extending the selection to the next line. Also, if word wrap is turned off, the insertion-point caret now follows any spaces you enter instead of ignoring the spaces.

Some implementation details​

The Windows 11 Notepad uses a window for its editing canvas and windows generally use GDI for displaying text and images. GDI doesn’t have functions to display color fonts in color, whereas DirectWrite does. To be able to use DirectWrite for color emoji and other enhancements, the new Notepad therefore creates a RichEDitD2DPT window, which uses DirectWrite for text and GDI for OLE objects (Notepad doesn’t insert OLE objects).

The RichEdit build used in Notepad comes from the same sources as the RichEdit that’s loaded with Microsoft 365 applications like Word, PowerPoint, Excel, and OneNote. It’s not the Windows RichEdit in msftedit.dll. Consequently, Notepad has the latest RichEdit improvements.

We’ve fixed bugs that didn’t show up for RichEdit plain-text controls over the years partly because before Notepad, the plain-text instances have been small.

Notepad uses RichEdit classic font binding instead of the IProvideFontInfo font binding used in XAML text controls and in RichEdit controls appearing in Microsoft 365 applications. Notepad doesn’t want to load the mso libraries used in the latter since these libraries are quite large. The classic font binding has been improved but needs to add support for more scripts.

We improved RichEdit’s performance for large ASCII files such as those for core dumps. One feature that can slow down reading in a large file is autoURL detection. While reading in plain text, LF and CRLF are translated to CR for internal use and in the process the text is checked for the combination “:/”. If that combination isn’t found and only AURL_ENABLEURL is enabled, autoURL detection is bypassed.

Future​

Imagine things that can be added given the power of RichEdit. RichEdit plain-text controls have only one paragraph format, but they can have considerable character formatting. The latter is needed because 1) Unicode has over 144,000 characters and a single font is limited to 65535 glyphs, and 2) input method editors (IMEs) and spell checkers require underlines and/or text coloring. So, although the user interface only exposes one character format, the TOM object model gives access to many more properties (see ITextFont2). Accordingly, it would be possible to offer program code syntax highlighting used, for example, in Visual Studio and Visual Studio Code. But probably that should be the domain of compiler interactive development environments. Another option could be to display HTML, XML, JSON, and RTF files with indentation and toggle between XML/HTML start and end tags like Ctrl+} does for bracketed expressions, e.g., in JSON and RTF files. Large file performance needs more improvement. Please feel free to comment about bugs and wishes!


Source:

See also:
 

Attachments

  • Notepad.png
    Notepad.png
    21.7 KB · Views: 0
And could someone perhaps upload those files?

Note that uploading a EXE or a MUI file directly is not allowed. And uploads large than 2MB is not allowed. So you can upload it to a file sharing Platform, like OneDrive.
 

My Computer

System One

  • OS
    EndeavourOS, Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    custom PC
    CPU
    Core i5 8400
    Motherboard
    Gigabyte B360M-HD3
    Memory
    8gb DDR4-2400
    Graphics Card(s)
    iGPU
    Sound Card
    Realtek
    Monitor(s) Displays
    some generic 1080p 75hz monitor * 2
    Screen Resolution
    1080p * 2
    Hard Drives
    GIGABYTE NVMe SSD 256GB (GP-GSM2NE3256GNTD)
    Internet Speed
    200MBit/s
    Antivirus
    WD
So after uninstalling Notepad from the Microsoft Store to get the old Notepad, I've realised that Notepad doesn't appear in "open with" dialogs. How can I fix the file associations?
 

My Computer

System One

  • OS
    Windows 11
A few MB below that?! I don't use Skype myself and don't know how large that file should be and whether you were actively typing in it. I assume that's a fairly big file though. And it's still a regression over the previous version, right?

Just to clarify, I saw 36MB when I typed in five words.
It's a 2.35MB file, it's the biggest one that I could find on my laptop with Everything Search. Memory usage of the new notepad after I open this file in it is 34MB no matter if I actively type a dozen or so sentences.
It's still a major regression either way for no benefit. A new icon means nothing to me.

11hx0h.jpg
 

My Computers

System One System Two

  • OS
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Asus TUF Gaming (2024)
    CPU
    i7 13650HX
    Memory
    16GB DDR5
    Graphics Card(s)
    GeForce RTX 4060 Mobile
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    512GB SSD internal
    37TB external
    PSU
    Li-ion
    Cooling
    2× Arc Flow Fans, 4× exhaust vents, 5× heatpipes
    Keyboard
    Logitech K800
    Mouse
    Logitech G402
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
  • Operating System
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Medion S15450
    CPU
    i5 1135G7
    Memory
    16GB DDR4
    Graphics card(s)
    Intel Iris Xe
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    2TB SSD internal
    37TB external
    PSU
    Li-ion
    Mouse
    Logitech G402
    Keyboard
    Logitech K800
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
I like the simplicity of Notepad because it does just what I want it to EXCEPT full screen. I used to be able to go into the properties and change it from "normal" to "maximised" when you open it. Now I cannot get it to open full screen! make full screen then exit - nope! drag the edge of the window to make it full screen then click X in the top right corner - nope!
So if you have Notepad, you can probably easily tweak it to do this, but this is a file on my DT called "Stuff" which sits in Notepad. It's various bits of information for quick ref. Any ideas people?
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    Homebuild
    CPU
    i7-10700F
    Motherboard
    ASROCK Z490 Pro4
    Memory
    64 GB DDR4
    Graphics Card(s)
    GeForce - Nvidia GTX 1660 (6GB)
    Sound Card
    built in (Realtek HD Audio)
    Monitor(s) Displays
    MSI Optix G241
    Screen Resolution
    1920x1080
    Hard Drives
    SSD x 2 evo Samsung 1tb each
    PSU
    600W
    Case
    Antec NX230 Gaming Case
    Cooling
    yes
    Keyboard
    DELL
    Mouse
    Logitech
    Internet Speed
    380 MB's / sec (D/L)
    Browser
    internet? Firefox
    Antivirus
    AVG Free
I'm sorry but I hate this "adding features" to basically simple apps that have worked witout problems for "Donkeys years" - If one needs a load of new features such as matching parentheses, HTML syntax checker, spell checker, code checker etcs then lets have another app -- Nothing wrong with that but sometimes I want just bog standard plain text whether in French, English, German, Icelandic etc and I don't want any "unnecessary propmpts etc).

Probably in a minority of one here but that's my view.

Cheers
jimbo
 

My Computer

System One

  • OS
    Windows XP,7,10,11 Linux Arch Linux
    Computer type
    PC/Desktop
    CPU
    2 X Intel i7
I agree @jimbo45 after all Notepad is only a very basic editor, better ones are available, I use it a lot for, well basic tasks. I use WordPad a lot as well
 

My Computers

System One System Two

  • OS
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    Alienware M18 R1
    CPU
    13th Gen Core i9 13900HX
    Memory
    32GB DDR5 @4800MHz 2x16GB
    Graphics Card(s)
    Geforce RTX 4090HX 16GB
    Sound Card
    Nvidia HD / Realtek ALC3254
    Monitor(s) Displays
    18" QHD+
    Screen Resolution
    25660 X 1600
    Hard Drives
    C: KIOXIA (Toshiba) 2TB KXG80ZNV2T04 NVMe PCIe M.2 SSD
    D: KIOXIA (Toshiba) 2TB KXG80ZNV2T04 NVMe PCIe M.2 SSD
    Case
    Dark Metallic Moon
    Keyboard
    Alienware M Series per-key AlienFX RGB
    Mouse
    Alienware AW610M
    Browser
    Chrome and Firefox
    Antivirus
    Norton
    Other Info
    Killer E3000 Ethernet Controller
    Killer Killer AX1690 Wi-Fi Network Adaptor Wi-Fi 6E
    Bluetooth 5.2
    Alienware Z01G Graphic Amplifier
  • Operating System
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    Alienware Area 51m R2
    CPU
    10th Gen i-9 10900 K
    Memory
    32Gb Dual Channel DDR4 @ 8843MHz
    Graphics card(s)
    Nvidia RTX 2080 Super
    Sound Card
    Nvidia
    Screen Resolution
    1920 x 1080
    Hard Drives
    Hard Drive C: Samsung 2TB SSD PM981a NVMe
    Hard Drive D:Samsung 2TB SSD 970 EVO Plus
    Mouse
    Alienware 610M
    Browser
    Chrome
    Antivirus
    Norton
Like others, I have a .txt file that is used as a kind of scratch pad for notes, links and other junk to be referred to later, just like I used to scribble on my real world desktop blotter. If I wanted a more capable editor, I'd go find one. I don't give a fig about rounded corners or other cosmetic tweaks. If it ain't broke, don't fix it.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    Stormforce Prism RTX 3070
    CPU
    Ryzen 9 5900X
    Motherboard
    Asus AMD TUF Gaming X570-Plus ATX Motherboard – Aura Sync RGB
    Memory
    16GB DDR4
    Graphics Card(s)
    RTX 3070
    Monitor(s) Displays
    2 x Samsung U32H850UMU 32 inch 4K
    Screen Resolution
    3840x2160
    Hard Drives
    1 x M2.2
    1x M2.1
    5 x HDD
    Cooling
    Cooler Master 120L AIO Watercooler
    Keyboard
    Rii wireless
    Mouse
    Generic cable
    Internet Speed
    320Mbps
    Browser
    Firefox & Chrome
    Antivirus
    Norton
I also like the simplicity of Notepad for certain functions (like notes!) and the new version with settings like dark theme is an improvement for me.
 

My Computer

System One

  • OS
    windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    Dell XPS 15 9510
    CPU
    11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz (16 CPUs
    Memory
    16 GB
    Graphics Card(s)
    NVIDIA GeForce RTX 3050 Ti
    Hard Drives
    512GB Solid State Drive
    Browser
    Chrome
I also like the simplicity of Notepad for certain functions (like notes!) and the new version with settings like dark theme is an improvement for me.
I like the dark mode and the simplicity Trevo, bang on
 

My Computers

System One System Two

  • OS
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    Alienware M18 R1
    CPU
    13th Gen Core i9 13900HX
    Memory
    32GB DDR5 @4800MHz 2x16GB
    Graphics Card(s)
    Geforce RTX 4090HX 16GB
    Sound Card
    Nvidia HD / Realtek ALC3254
    Monitor(s) Displays
    18" QHD+
    Screen Resolution
    25660 X 1600
    Hard Drives
    C: KIOXIA (Toshiba) 2TB KXG80ZNV2T04 NVMe PCIe M.2 SSD
    D: KIOXIA (Toshiba) 2TB KXG80ZNV2T04 NVMe PCIe M.2 SSD
    Case
    Dark Metallic Moon
    Keyboard
    Alienware M Series per-key AlienFX RGB
    Mouse
    Alienware AW610M
    Browser
    Chrome and Firefox
    Antivirus
    Norton
    Other Info
    Killer E3000 Ethernet Controller
    Killer Killer AX1690 Wi-Fi Network Adaptor Wi-Fi 6E
    Bluetooth 5.2
    Alienware Z01G Graphic Amplifier
  • Operating System
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    Alienware Area 51m R2
    CPU
    10th Gen i-9 10900 K
    Memory
    32Gb Dual Channel DDR4 @ 8843MHz
    Graphics card(s)
    Nvidia RTX 2080 Super
    Sound Card
    Nvidia
    Screen Resolution
    1920 x 1080
    Hard Drives
    Hard Drive C: Samsung 2TB SSD PM981a NVMe
    Hard Drive D:Samsung 2TB SSD 970 EVO Plus
    Mouse
    Alienware 610M
    Browser
    Chrome
    Antivirus
    Norton
Back
Top Bottom