[Top][All Lists]

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

Re: Line wrap reconsidered

From: Yuan Fu
Subject: Re: Line wrap reconsidered
Date: Mon, 25 May 2020 15:51:48 -0400

> On May 25, 2020, at 3:31 PM, Stefan Monnier <address@hidden> wrote:
>> I’ve implemented and used a lisp-based line-wrapping feature for a while and
>> it’s still sub-optimal for me. I now want to try to explore if I can add it
>> directly to redisplay. 
>> 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. 
> I don't think I can discuss the quality of this proposal without first
> understanding the intended use cases (including who/how/when the
> property would be added).

I’ve added the intended use case on the previous message. I’m not sure when to 
add the property yet. Right now I only have a general idea of using text 
property as a cache, so the more complex wrapping rule does not slow down 
redisplay. There could be a table specifying a mapping from unicode ranges to 
“wrappablility” (can/can't wrap before/after) and some one will iterate each 
character and apply the text property. The good thing is that this 
“wrappability” property of a character never changes, so we only need to 
calculate it once.

The redisplay code doesn’t need to change greatly since checking for 
“wrappability” is similar to checking “whitespace_p”.


reply via email to

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