Re: PSA: HTML fragment mode interaction between Chromium, Clipboard & Notepad++

Maria Sophia <[email protected]> Tue, 10 Feb 2026 09:07:03 -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:
> 
>> When you copy text from any Chromium-based application, Apparently Windows
>> does not just copy plain text. Windows actually puts two versions of the
>> text on the Windows clipboard:
>> 1. a normal plain-text version
>> 2. a hidden HTML-formatted version
> 
> Not uncommon for many apps to make multiple formats avaailable on the 
> clipboard.
> 
>> When we paste that clipboard data into Notepad++, Notepad++ sees the hidden
>> HTML version and Notepad++ assumes the paste is part of a larger HTML
>> fragment. That puts Notepad++ into a strange internal state, which is
>> apparently sometimes called "HTML fragment mode".
> 
> I think notepad++ has a "paste special" command, does that let you pick 
> the plain text version?

Thanks for trying to help out, Andy, as I respect your knowledge and that
of Paul, Carlos, and others, as I will always be open when I say I never
really understood this stuff but I need to fix it with my Notepad++ macro.

One of the first things I tried was Control+Shift+V and the Notepad++ hex
editor, but neither seemed to help so I gave up on both of them long ago.

Notepad++'s "Paste Simple Text" command only works if the clipboard
actually contains a plain-text flavor that Notepad++ recognizes as usable.

Chromium does put plain text on the clipboard but there's a catch.
Chromium puts the HTML flavor first & marks it as the "preferred" format.

Even when we use Paste Simple Text, Notepad++ still has to ask Windows for
the available formats. If Windows reports the HTML flavor as the "best
text-like format," Notepad++ may still pick it.

Given that inconsistency, it seems... 
 a. Ctrl+V always triggers HTML fragment mode
 b. Ctrl+Shift+V sometimes still triggers HTML fragment mode
The only guaranteed way to break the mode is to modify the buffer (i.e.,
insert/delete a line).

My issue is I can't fix it in my Notepad++ macro until I understand it.
And to understand it, I'd like to *see* it. But it's invisible!

Oddly, I don't see this problem with Mozilla browsers. 
Just Chromium-based browsers. 

Huh?

Interestingly, both Chromium and Firefox can place multiple formats on the
clipboard (plain text, HTML, images, etc.). That part is normal and very
old Windows behavior as Carlos astutely already noted in a prior post.

Chromium browsers (Edge, Chrome, Brave, Vivaldi, Electron apps) add extra
metadata to the HTML clipboard flavor, e.g., StartHTML, EndHTML,
StartFragment, EndFragment. 

Notepad++ interprets this as a fragment boundary and enters "HTML fragment
mode." That's what breaks Ctrl+A and Ctrl+X.
 <https://github.com/notepad-plus-plus/notepad-plus-plus/issues/13748>

Firefox does not add those fragment markers in the same way. It typically
places plain text and a simpler HTML representation without the
Chromium-style fragment metadata.
 <https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard>

Go figure. Did I mention I never understood all this character stuff?