Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.comp.os.windows-10    |    Steaming pile of horseshit Windows 10    |    197,590 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 197,274 of 197,590    |
|    Maria Sophia to Carlos E. R.    |
|    Re: PSA: HTML fragment mode interaction     |
|    10 Feb 26 07:44:52    |
      XPost: alt.comp.os.windows-11, alt.comp.microsoft.windows       From: mariasophia@comprehension.com              Carlos E. R. 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       >       > This is a very old Windows feature. It is up to the receiving       > application to choose what version to paste.       >       > With a clipboard manager perhaps you can choose the version yourself.              Hi Carlos,              Thanks for pointing that out as this artifact has been biting me because I       really never understood how the characters are stored in the clipboard.              I believe that you are absolutely right that Windows has supported multiple       clipboard formats for a long time and that applications are free to       offer several representations of the same data. That part is completely       normal, and your reminder helps me double-check that angle while I was       debugging this.              The part that took me a while to uncover is what Chromium-based       applications actually place on the clipboard. They do not just provide       plain text. They also provide a CF_HTML fragment with StartFragment and       EndFragment markers. That HTML fragment is what Notepad++ ends up choosing       when pasting.              Once Notepad++ sees that HTML fragment, it switches into what apparently       some people call "HTML fragment mode". In that mode, the editor treats the       first line of the buffer as a fragment boundary. That boundary is invisible       in the editor, but it affects selection logic.              As a result:       a. Ctrl+A flashes but does not select the entire document       b. Hence, Ctrl+X does nothing because selections behave incorrectly              This happens even in a brand-new, unsaved buffer with no BOM and no       encoding issues. Surprisingly, the Notepad++ hex editor will not show       anything unusual because the artifact is not in the pasted text itself.              The artifact is actually in the clipboard metadata that Chromium adds.              The workaround (inserting and then deleting a blank line at the top) forces       Notepad++ to abandon HTML fragment mode and treat the buffer as plain text       again. After that, Ctrl+A and Ctrl+X work normally. Ask me how I know this.              So yes, Windows is behaving as designed by offering multiple clipboard       formats and your point about applications choosing which format to paste is       correct. The unexpected part for me is that Notepad++ selects the HTML       flavor from Chromium and then Notepad++ enters a special mode that breaks       normal selection behavior.              Your comment helped me frame the explanation more clearly, so thanks for       that useful added value, which is why we're all here on Usenet. To learn.       --       Every Usenet post should strive to add palpable additional value       so that we can all delight in dissemination of useful knowledge.              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca