Can't insert non-breaking space (U+00A0) in message composition, and existing nbsp converted into space (0x20) when surrounding characters are altered/deleted - STR: Comment #6
Categories
(Thunderbird :: Message Compose Window, defect, P3)
Tracking
(Not tracked)
People
(Reporter: neil_mayhew, Unassigned)
References
Details
(Keywords: dataloss, ux-consistency, ux-efficiency, Whiteboard: [poor/fragile workaround: comment 4] [Tools for analysis: comment 6])
Attachments
(1 file)
Reporter | ||
Updated•15 years ago
|
Updated•15 years ago
|
Comment 2•7 years ago
|
||
Comment 3•7 years ago
|
||
Updated•7 years ago
|
Comment 4•7 years ago
|
||
Comment 5•7 years ago
|
||
Comment 6•7 years ago
|
||
str |
Updated•7 years ago
|
Comment 7•7 years ago
|
||
Comment 8•7 years ago
|
||
Comment 9•7 years ago
|
||
Updated•7 years ago
|
Comment 10•7 years ago
|
||
Comment 11•7 years ago
|
||
Comment 12•7 years ago
|
||
Comment 13•7 years ago
|
||
Comment 14•7 years ago
|
||
Comment 15•7 years ago
|
||
Comment 16•7 years ago
|
||
Comment 17•7 years ago
|
||
Comment 19•3 years ago
|
||
https://github.com/Betterbird/thunderbird-patches/blob/main/91/bugs/532712-insert-NBSP.patch
Partial solution to add a NBSP with Ctrl+Shift+Space. Working well in a plaintext composition; in a HTML composition the next character typed replaces the just inserted NBSP with a regular space again, which is the second part of the bug ("existing nbsp converted into space (0x20) when surrounding characters are altered/deleted"). Ctrl+Shift+Space works OK to insert a character between two others. A full fix will require Core::Editor changes.
Comment 20•3 years ago
|
||
As has been discussed in bug 359303 (for example bug 359303 comment #72) French typography mandates a space after the opening quote «
and a space before the closing quote »
, and also in front of an exclamation mark, so for example « Bonsoir ! »
. In order to prevent unwanted line wrapping, NBSP needs to be used. French-speaking/writing Mozilla users have struggled for a long time with the fact that all Mozilla editing in FF and TB removes NBSP even if the user manages to enter them via a special key sequence or via pasting. Henri makes the case to improve the situation in bug 359303 comment #98.
We've implemented a Ctrl+Shift+Space function for Thunderbird, see here and the processing is much simpler if the Mozilla editor doesn't replace NBSP with ASCII space, which we've hacked into place here for ESR 91. That removes these two blocks:
https://searchfox.org/mozilla-central/rev/9ca193b4233957439583f2eadabbd3cfb4cd9fed/editor/libeditor/WSRunObject.cpp#1046-1052
https://searchfox.org/mozilla-central/rev/9ca193b4233957439583f2eadabbd3cfb4cd9fed/editor/libeditor/WSRunObject.cpp#3120-3132.
Curiously enough, only removing one of the blocks didn't have the desired effect. Removing the two blocks has the side effect that a x\u00a0 y
test is not corrected to x y
any more if the second space is removed.
Masakuyi-san, what is the motivation to replace NBSP with ASCII space? The comments suggest that this is done "just to prevent NBSP proliferation" which is not a very good reason to make the life of French speakers hard. Another reason mentioned is Blink compatibility, but that doesn't see to be switched on so far (and the second code block will still remove NBSP between visible characters which is not necessarily desirable).
Can the editor be changed to allow entering of NBSP more easily?
Comment 21•3 years ago
|
||
Masakuyi-san, what is the motivation to replace NBSP with ASCII space?
One big reason of doing it is, editor cannot remember whether each NBSP is inserted as-is or converted from a collapsible white-space. If the latter, doing it is the right thing. However, if the former, yes, it's this bug.
The comments suggest that this is done "just to prevent NBSP proliferation" which is not a very good reason to make the life of French speakers hard. Another reason mentioned is Blink compatibility, but that doesn't see to be switched on so far (and the second code block will still remove NBSP between visible characters which is not necessarily desirable).
One possible solution for Thunderbird which I think is, if the editor is a mail editor, set white-space: pre-line
to the <body>
and stop the white-space normalization. However, (although I'm not sure) Thunderbird could need to remove the style and do normalizing white-spaces before sending the email because some legacy MUA may not support the style.
Comment 22•3 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #21)
One big reason of doing it is, editor cannot remember whether each NBSP is inserted as-is or converted from a collapsible white-space. If the latter, doing it is the right thing. However, if the former, yes, it's this bug.
Understood. However, the conversion could be a lot less aggressive, for example, insertText("\u00a0")
should not immediately insert an ASCII space, and typing the B of A\u00a0B
should also not trigger the replacement, even removing the B on «\u00a0B
shouldn't trigger the replacement. Clean-up of NBSP which was auto-inserted from collapsible white-space should only be done when cleaning up longer stretches of white-space where NBSP is adjacent to regular ASCII space, which is also the suggested solution for bug 359303.
Is this not also an issue for Webmail in Firefox?
Comment 23•3 years ago
|
||
During testing we also noted the following: Starting from A B
and removing the B
via backspace, there appears to be an intermediate state of A\u00a0
. That makes the removal of the NBSP necessary when the next character is typed. And exactly that logic also replaces manually inserted NBSP. For the purposes of the mail client we've hacked this now, but given that this is registered as a Core::Editor bug we'd like to suggest to maybe revise the algorithm: If less NBSP are created automatically, less need to be removed later which reduces the scope of also removing user-entered ones.
Updated•3 years ago
|
Comment 24•3 years ago
|
||
I confirm NBSPs are still automatically converted to regular spaces in message composition and other fields such as calendar event fields… and on copying and pasting text.
Comment 25•3 years ago
|
||
Reiterating, since some developers still seem to misrepresent the problem: the editor software MUST NOT insert non-breaking spaces at will. Normalisation of white space is a feature of HTML itself and the HTML editor has no business in messing around with that. That means sequences of consecutive spaces should be collapsed on input. This unfortunately means no French spacing for me; I understand that French spacing is a feature of the renderer and should not be hardwired into the text. I also understand that the rendering engine does not currently provide such an option to me, which is deplorable but by no means as toxic and debilitating as this bug and the accompanying ones.
The only reliable way to have consecutive, initial or trailing spaces in HTML is to put them into a text control. This has been a recurring source of misunderstandings, drama and waste of time in browser-facing database applications since the Bing Bang. We should offer another document format for editors who cannot put up with this.
OTOH, the editor software MAY automatically use non-breaking space in a locale-specific way where appropriate, as an opt-in feature. This includes hyphenation aids too.
Comment 26•3 years ago
•
|
||
Probably, this has already been fixed in bug 1724650 from point of view of Core product. The remaining issue is probably that mail composer does not specify white-space: pre-wrap
to the body. However, I'm not sure whether the style is available in any major mail-apps. Therefore, it's out of scope of this bug that whether specifying the style and exposes it as-is or converting only collapsible white-spaces to NBSPs or not at sending email it. I'll add automated tests for avoiding regressions in the Core product.
Comment 27•3 years ago
|
||
Comment 28•3 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Away: ~5/8) from comment #21)
One possible solution for Thunderbird which I think is, if the editor is a mail editor, set
white-space: pre-line
to the<body>
and stop the white-space normalization.
Oh, s/pre-line/pre-wrap
(In reply to Rachel Martin from comment #22)
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #21)
One big reason of doing it is, editor cannot remember whether each NBSP is inserted as-is or converted from a collapsible white-space. If the latter, doing it is the right thing. However, if the former, yes, it's this bug.
Understood. However, the conversion could be a lot less aggressive, for example,
insertText("\u00a0")
should not immediately insert an ASCII space, and typing the B ofA\u00a0B
should also not trigger the replacement, even removing the B on«\u00a0B
shouldn't trigger the replacement. Clean-up of NBSP which was auto-inserted from collapsible white-space should only be done when cleaning up longer stretches of white-space where NBSP is adjacent to regular ASCII space, which is also the suggested solution for bug 359303.Is this not also an issue for Webmail in Firefox?
Could be. However, basically, web-apps should use white-space: pre-wrap
and convert it at sending email if they need some conversion for compatibility with the other MUAs. For web-compat, we should emulate Blink's white-space normalizer as far as possible (bug 1658699). However, it's big project and currently there are no serious bug reports about this difference. So we won't fix it soon.
Comment 29•3 years ago
|
||
This bug was originally filed in Thunderbird/Message Compose Window and was moved to Core/Editor after comment #6. If the NBSP issue is now fixed for white-space: pre-wrap
, this will still not give Thunderbird users what they need since TB so far doesn't use white-space: pre-wrap
and it would need some investigation as to whether it can use that. So it's probably best to move the bug back to Thunderbird and land your tests in a new bug specifically for white-space: pre-wrap
.
To address mail users' needs, we have added two things to our mail client:
At comm level, a command that adds NBSP: https://github.com/Betterbird/thunderbird-patches/blob/main/102/bugs/532712-insert-NBSP.patch
At Mozilla level, a nasty hack that ensures the added NBSP isn't removed again when the next character is typed:
https://github.com/Betterbird/thunderbird-patches/blob/main/102/bugs/532712-insert-NBSP-m-c.patch
That's not ideal, it only maintains the NBSP if you type A 0xa0 B, but not A 0xa0 B <del> C. But better than nothing.
Comment 30•3 years ago
|
||
Probably, the editor's bug has already been fixed in bug 1724650 which makes
HTMLEditor
and WhiteSpaceVisibilityKeeper
handle white-spaces of
white-space: pre-*
correctly. Therefore, once Thunderbird or some other
MUAs which uses Gecko as its mail composer specify white-space: pre-wrap
,
at least the editor will work as users expected.
This patch just adds automated tests for avoiding the regressions in Gecko-side.
Comment 31•3 years ago
|
||
Sure. Once I land the test for mozilla-central, I'll make this moved back to Thunderbird. However, it might be better to open new bug because this bug has 30 comments which makes newbies of this bug harder to understand what is the remaining issue.
Comment 32•3 years ago
|
||
Comment 33•3 years ago
|
||
The simplest fix as an application of Thunderbird is, setting white-space: pre-wrap
to the <body>
element of editor document. However, if it's sent to another MUA's user, the style might be ignored. Although even IE8 supports it, but I guess that there are some MUAs which serialize HTML simply. So, from compatibility between MUAs, it might be safer to remove the style at sending, and replaces collapsible white-spaces when serializing. However, I don't know whether it's worthwhile to do it or not.
On the other hand, in plaintext emails, perhaps, the plaintext serializer would break the NBSPs which are intentionally inserted.
Comment 34•3 years ago
|
||
So leaving NBSP inserted with insertText("\u00a0")
alone (instead of replacing it with a normal space on the next key stroke) is not an option for the core editor?
Comment 35•3 years ago
|
||
(In reply to Rachel Martin from comment #34)
So leaving NBSP inserted with
insertText("\u00a0")
alone (instead of replacing it with a normal space on the next key stroke) is not an option for the core editor?
Ah, that should be fixed with the compatibility with Chrome. However, replacing around the inserted NBSP is odd even in Chrome. So it requires a lot of time to investigate the behavior, and I guess that that will require to reimplement the white-space normalizer in bug 1658699. So it cannot be a short term solution.
Comment 36•3 years ago
|
||
bugherder |
Updated•3 years ago
|
Updated•3 years ago
|
Comment 37•3 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Away: ~5/8) from comment #35)
Ah, that should be fixed with the compatibility with Chrome. ...
That makes it sound like this bug still belongs into Core/Editor. It's unlikely that TB will change to white-space: pre-wrap
also given that the receiving end might not support it.
Comment 38•3 years ago
|
||
(In reply to Rachel Martin from comment #37)
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Away: ~5/8) from comment #35)
Ah, that should be fixed with the compatibility with Chrome. ...
That makes it sound like this bug still belongs into Core/Editor.
Partially, yes, but it should be fixed in bug 1658699.
It's unlikely that TB will change to
white-space: pre-wrap
also given that the receiving end might not support it.
So, I recommend that touching the DOM tree before sending, but use white-space: pre-wrap
while composing email. Otherwise, anyway NBSPs may be silently converted to collapsible white-spaces when normal white-spaces come next to NBSPs.
Description
•