Re: PSA: HTML fragment mode interaction between Chromium, Clipboard & Notepad++
Maria Sophia <[email protected]> Wed, 11 Feb 2026 18:21:06 -0500
| Newsgroups | alt.comp.os.windows-10,alt.comp.os.windows-11,alt.comp.microsoft.windows |
|---|---|
| Organization | BWH Usenet Archive (https://usenet.blueworldhosting.com) |
| Message-ID | <[email protected]> |
Maria Sophia wrote:
>
> <NotepadPlus>
> <InternalCommands>
> <Shortcut id="43009" Ctrl="no" Alt="no" Shift="no" Key="0" />
> </InternalCommands>
> <Macros>
Whomever it was that wrote Notepad++/Scintilla should be shot.
Notepad++ rewrote my file because I did NOT put that in the file.
Certainly I would have put it at the bottom besides.
<NotepadPlus>
<InternalCommands>...</InternalCommands>
<Macros>
<Macro name="ASCII" ...>
<Action>...</Action>
<Action>...</Action>
...
</Macro>
</Macros>
</NotepadPlus>
Apparently Notepad++ regenerates the XML in this order:
<NotepadPlus>
<InternalCommands>
<Macros>
<UserDefinedCommands>
<ScintillaKeys>
<UserShortcuts>
<PluginCommands>
<Macros> content
It does not respect my original order.
Specifically it reorders <Action> blocks.
Which it does extremely unintelligently.
Such that U+2060 being executed after the other zero-width characters.
Aurgh. I didn't realize Notepad++ was messing with the shortcuts.xml!
I have to force Notepad++ to rebuild the macro action list.
1. Open Notepad++ without shortcuts.xml in any editor.
2. Go to Macro -> Modify Shortcut / Delete Macro
3. Find the macro in the list & select it.
4. Click "Delete" & then close Notepad++ completely
5. Open shortcuts.xml in gVim (or any editor that is NOT Notepad++).
6. Paste the original macro back into shortcuts.xml.
Make sure the U+2060 removal block is the very first Action
in the entire macro, before any other Action.
7. Save the file making sure nothing else related is running.
8. Start Notepad++ again and re-run the grueling test.
This changed the shortcuts.xml to the following:
<?xml version="1.0" encoding="UTF-8" ?>
<!-- C:\app\editor\txt\Notepad++\shortcuts.xml for Windows Notepad++ -->
<!-- v3p9 20260211 Notepad++ is not running the macro in the order shown
-->
<!-- Notepad++ is executing macro actions in a different order -->
<!-- than they appear in the XML so a total rewrite is needed in v4p0 -->
<!-- v3p8 20260211 U+2060 is driving me nuts so it's the first block now
-->
<!-- v3p7 20260211 moved U+2060 up because it's the most disruptive -->
<!-- v3p6 20260211 U+2009 & U+200B not being converted properly -->
<!-- v3p5 20260211 fixed U+200B failing when U+200B is between ' & s -->
<!-- A 2nd pass was duplicated after apostrophe normalization rules
-->
<!-- v3p4 20260211 added U+275E (heavy double quote right) -->
<!-- v3p3 20260211 added U+2009 (thin space) -->
<!-- v3p2 20260211 added seven new conversions after running testcases -->
<!-- U+02BE (modifier letter right half ring) -->
<!-- U+02BF (modifier letter left half ring) -->
<!-- U+201E (double low-9 quote) -->
<!-- U+201F (double high-reversed-9 quote) -->
<!-- U+275D (heavy double quote left) -->
<!-- U+275E (heavy double quote right) -->
<!-- U+2015 (horizontal bar) -->
<!-- U+2009 (thin space) -->
<!-- v3p1 20260211 reorganized into a dozen distinct categories -->
<!-- (1) control characters: U+000F U+0001 -->
<!-- (2) dashes & minus signs: U+2010 U+2011 U+2012 U+2212 -->
<!-- (3) zero-width characters: U+200C U+200B U+200D U+FEFF U+2060 -->
<!-- (4) special spaces: U+00A0 U+2007 U+202F U+200A U+2008 U+2006 -->
<!-- (5) apostrophe-like characters:
U+0F0C U+2018 U+2019 U+2032 U+02BC U+02B9 U+02C8 U+02EE
U+201B U+02CB U+A78C U+FF07 -->
<!-- (6) combining marks (remove after apostrophes):
U+0351 U+0307 U+0331 U+0335 U+0336 U+0337 U+0338 -->
<!-- (7) double-quote normalization: U+201C U+201D -->
<!-- (8) dash-like & ellipsis & HTML entities:
U+2026 — U+2014 U+2013 ‌ -->
<!-- (9) bullets, math symbols, diacritics:
U+2022 U+8722 U+011F U+2009 U+00E1 U+0161 U+011B -->
<!-- (10) miscellaneous symbols:
U+2713 ASCII hyphen ` U+2192 U+00B0 U+00A9 U+2122 U+00AE -->
<!-- (11) invisible operators:
U+00AD U+2061 U+2062 U+2063 U+2064 U+180E -->
<!-- (12) line separators: U+2028 U+2029 U+0085 -->
<!-- v3p0 20260211 added combining marks U+0351 U+0307 U+0331 -->
<!-- v3p1 20260211 added apostrophe-like characters U+201B U+02CB -->
<!-- v2p9 20260211 moved U+2060 to be above apostrophe-related blocks -->
<!-- v2p8 20260211 fixed Chromium CF_HTML paste control+A anomaly -->
<!-- v2p7 20260211 added U+02EE modifier letter double apostrophe rule -->
<!-- v2p6 20260211 fixed U+02C8 modifier letter vertical line) rule -->
<!-- v2p5 20260211 fixed U+02B9 (modifier letter prime) rule -->
<!-- v2p4 20260211 removed one of two U+000F blocks -->
<!-- v2p3 20260211 removed two (duplicate) 1700 lines in U+0161 -->
<!-- v2p2 20260211 fixed all zero-width blocks to replace with nothing -->
<!-- v2p1 20260211 fixed BOM to replace with nothing -->
<!-- v2p0 20260210 cleaned (emptied out) closing sections of the file -->
<!-- v1p9 20260210 ported old shortcuts.xml to improve coverage -->
<!-- Cleans Chromium pasted text & normalizes Unicode to ASCII -->
<!-- Use model: paste (using control+v) & fix (using control+b) -->
<!-- The macro should 1st break CF_HTML fragment mode (so Ctrl+A works) -->
<!-- and then run the Unicode-to-ASCII cleanup on all the pasted text -->
<!-- cutting (control+x) the result back into the Windows clipboard -->
<!-- thereby leaving the Notepad++ GUI empty & ready for the next paste-->
<!--
To break Scintilla's CF_HTML fragment mode, we need to make any edit.
We can insert a space & then delete that space, for example.
-->
<!-- Scintilla engine command meanings:
1700 = begin a new search/replace operation
1601 = set the search string (the Unicode character to find)
1625 = clear the replacement buffer
1602 = set the replacement string (ASCII equivalent)
1702 = execute Replace All
1701 = end this search/replace block
2001 = SCI_REPLACESEL (inserts a space)
2326 = SCI_DELETEBACK (deletes the space)
2013 = SCI_SELECTALL (selects everything)
2177 = SCI_CUT (cut all)
-->
<!-- When you paste from a Chromium-based app, the clipboard contains:
CF_UNICODETEXT (plain text) & CF_HTML (HTML fragment)
And sometimes CF_RTF where Notepad++ prefers CF_HTML if available.
v2p0 fixes a Notepad++ selection issue caused by CF_HTML pastes.
"HTML Paste Mode" prevents the "Control+A" from working.
"HTML paste mode" inserts HTML fragment as plain text
where Ctrl+A is disabled until the buffer is "normalized"
(until the first edit that breaks the fragment state)
-->
<!-- Below is garbage that Notepad++ adds to shortcuts.xml -->
<NotepadPlus>
<InternalCommands>
<Shortcut id="43009" Ctrl="no" Alt="no" Shift="no" Key="0" />
</InternalCommands>
<Macros />
<UserDefinedCommands />
<PluginCommands />
<ScintillaKeys />
</NotepadPlus>
This proves that only the comments remained.