Re: [css-text] white-space: pre-wrap

> On 25 Sep 2015, at 01:21, fantasai <fantasai.lists@inkedblade.net> wrote:
> 
> On 09/24/2015 03:13 AM, Florian Rivoal wrote:
>>>>> 2. The resolved behavior would give you a bit strange experience if a word ends at the right margin, then you'd see the space character on the beginning of the next line. Are we sure we want this behavior?
>>>> 
>>>> I think so. The author asked for preserve and wrap, that's what he gets. For "smart" perserve and wrap, allowing UAs to decide what to do about spaces left at the end of the line, you can use the pre-wrap-auto value instead.
>>>> 
>>>> And if the author wants to be explicit (rather than automagic) about removing spaces at the end of the line, there's the pre-wrap-trim value to be added in level 4 (I'll send a pull request about this shortly).
>>> 
>>> Preserving is fine, I agree, but can you share in what use cases who asked to wrap before a space character?
>>> 
>>> Take an example: "hello world" and it hits right margin after "o". You will then see a space at the beginning of the 2nd line.
>>> 
>>> So to re-word my question, break between SP + SP is ok, but I wonder whether AL + SP makes sense or not, and whether this is intentional?
>> 
>> The main point of the F2F discussion was SP+SP. Whether AL+SP should be a special case was briefly mentioned during the discussion, and we prefered keep the model simple and predictable. I think that's particularly valuable in editable text fields using pre-wrap: whenever you press space, you visibly insert a space, if there was room on the line, then it goes there. If there is not, it goes to the next line. That makes editing much more predictable and understandable.
> 
> Spaces introduce a break opportunity after them, but not before them.
> There's an additional rule in Unicode that SP+SP does not break, and
> that is the rule we're removing. However, AL+SP still will not break.

That's not what we resolved:
"RESOLVED: pre-wrap preserves all spaces visibly and allows wrapping before and after every space."

https://lists.w3.org/Archives/Public/www-style/2015May/0281.html

What went into the spec (PR by me, merged by Koji) is in line with the resolution:

"if white-space is set to pre-wrap, any sequence of spaces is preserved. This is achieved by treating it as a sequence of non-breaking spaces, except that a soft wrap opportunity exists between each of the spaces of this preserved sequence, as well as at the beginning and at the end of the sequence."

https://drafts.csswg.org/css-text-3/#collapse

 - Florian

Received on Friday, 25 September 2015 06:51:34 UTC