Subject: bug#5018: 23.1.50; Feature request: truncate-lines text property

From: Eli Zaretskii <[email-masked]>
Date: Mon, 05 Jun 2017 18:42:12 +0300

> From: Michael Brand <[email-masked]>
> Date: Mon, 5 Jun 2017 11:29:54 +0200
> Cc: [email-masked]
> 
> > Would you like to work on implementing this feature?  I can provide
> > guidance if needed.
> 
> I can try. Maybe too ambitious for me or at least for me alone. I am
> new for example to the style of C in Emacs and to the display engine.
> And as usual for everybody my time is limited but as I have a need for
> this feature since maybe years I could compensate a bit with patience
> unless anybody wants to beat me.

If you decide to try it, I suggest to start by looking at my recent
changes that introduced hscrolling of only the current line.  This
feature should use similar techniques and touch the same places.

> >   . what text is supposed to have this property to mark the line as
> >     truncated, and how will Emacs know where the effect of the
> >     property ends?  e.g., will we require the property to be set on
> >     the entire line, including the newline, or will it be enough to
> >     set it only on part of the line?
> 
> The property only on \n looks good at first sight

The property on a newline makes the preceding line truncated or the
following line?  If the former, than what about the last line in a
buffer that doesn't end in a newline?  Also, looking for the property
in a very long line could slow down redisplay, since it would need to
know about this when it gets to the first character of the line.

> Anyway, I don't know if a text property will be the right solution in
> the end.

What other solution is possible?

> >   . when point moves along a line which is being truncated, and goes
> >     outside of the visible portion of the window, how do we want to
> >     hscroll the text in the window, in those parts that display lines
> >     which wrap?
> 
> This made me think most.
> 
> My first thought was:
> 
> Truncate on the left in sync with truncated lines and rewrap on the
> right
> 
>     :             #################
>     :    trunc1 tr#$unc2 trunc3 t$#
>     :    wrap1 wra#$p2 wrap3 wrap\#
>     :    4 wrap5 w#$rap6 wrap7 wr\#
>     :    ap8      #               #
>     :             #################
> 
> would lower or avoid column-related problems like with rectangle edit
> or ruler-mode. On the other hand I hope that changing what is the
> buffer bottom line after rewrap would not call for other problems.
> 
> But what would it help to wrap on the right when information is
> already hidden on the left? So...
> 
> My second thought is:
> 
> Fall back to truncate all lines
> 
>     :             #################
>     :    trunc1 tr#$unc2 trunc3 t$#
>     :    wrap1 wra#$p2 wrap3 wrap$#
>     :    more line#$s             #
>     :    even more#$ lines        #
>     :             #################
> 
> until column 0 becomes visible again is probably much easier, also for
> the user to understand what happens.

It could well be that the first variant is easier to implement.

> Should this discussion move to emacs-devel to reach more developers?

I'm not sure.  Most if not all of the relevant people read the bug
list as well.  Perhaps post a short message to emacs-devel telling the
interested people to read this discussion either via the bug tracker
or via the bug-gnu-emacs list.