emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Line wrap reconsidered


From: Ihor Radchenko
Subject: Re: Line wrap reconsidered
Date: Tue, 26 May 2020 09:55:46 +0800

>> Here is what I come up with: in redisplay code, instead of only
>> checking for whitespace, check for a ‘no-wrap text-property, if the
>> character has this property, don’t wrap before[1] this character (or
>> maybe it can be the opposite, only wrap when the character has a
>> ‘can-wrap property). And this text property is calculated and applied
>> once.  
>
> What are the use cases for such a feature?

There is another possible use case for this. Consider an org document
containing normal text and very wide table.

-----------------------------------------------------------------------
-----------------------------------------------------------------------
Nunc porta vulputate tellus.  Nunc eleifend leo vitae magna.  Nunc rutrum 
turpis sed pede.  In id erat non orci commodo lobortis.  Aliquam posuere.  
Aliquam posuere.  Donec vitae dolor.  Vestibulum convallis, lorem a tempus 
semper, dui dui euismod elit.

| Nam euismod tellus id erat. | Donec neque quam, dignissim in. | Phasellus 
neque orci,                              | Nullam rutrum.                       
 | Nulla posuere.               | Nulla posuere.                | Nunc aliquet, 
augue nec. | Sed diam.                      |
| Nulla facilisis, risus a    | Nunc aliquet, augue nec         | Nulla 
facilisis, risus a rhoncus fermentum, tellus | In id erat non orci commodo 
lobortis. | Nunc rutrum turpis sed pede. | Cras placerat accumsan nulla. | 
Nullam rutrum.           | Donec hendrerit tempor tellus. |
-----------------------------------------------------------------------
-----------------------------------------------------------------------

With line wrapping:

-----------------------------------------------------------------------
-----------------------------------------------------------------------
Nunc porta vulputate tellus.  Nunc eleifend leo vitae magna.  Nunc
rutrum turpis sed pede.  In id erat non orci commodo lobortis.  Aliquam
posuere.  Aliquam posuere.  Donec vitae dolor.  Vestibulum convallis,
lorem a tempus semper, dui dui euismod elit. 

| Nam euismod tellus id erat. | Donec neque quam, dignissim in. |
| Phasellus neque orci,                              | Nullam rutrum.
| | Nulla posuere.               | Nulla posuere.                | Nunc
| aliquet, augue nec. | Sed diam.                      | 
| Nulla facilisis, risus a    | Nunc aliquet, augue nec         | Nulla
| facilisis, risus a rhoncus fermentum, tellus | In id erat non orci
| commodo lobortis. | Nunc rutrum turpis sed pede. | Cras placerat
| accumsan nulla. | Nullam rutrum.           | Donec hendrerit tempor
| tellus. | 
-----------------------------------------------------------------------
-----------------------------------------------------------------------

The table becomes completely unreadable with line wrapping. It would
make sense to have an option not to wrap the table even when lines are
not truncated.

If the display backend supports such things, font-lock may take care
about putting the needed ‘no-wrap or 'wrap text properties.

Best,
Ihor

Eli Zaretskii <address@hidden> writes:

>> From: Yuan Fu <address@hidden>
>> Date: Mon, 25 May 2020 14:13:04 -0400
>> 
>> Here is what I come up with: in redisplay code, instead of only checking for 
>> whitespace, check for a ‘no-wrap text-property, if the character has this 
>> property, don’t wrap before[1] this character (or maybe it can be the 
>> opposite, only wrap when the character has a ‘can-wrap property). And this 
>> text property is calculated and applied once. 
>
> What are the use cases for such a feature?
>
>> Is checking text property is fast enough for redisplay?
>
> We do this all the time in the display code, so speed shouldn't be a
> problem.
>

-- 
Ihor Radchenko,
PhD,
Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong 
University, Xi'an, China
Email: address@hidden, address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]