Subject: bug#34513: display-line-numbers in term mode

From: Ergus <[email-masked]>
Date: Wed, 23 Oct 2019 01:06:05 +0200

On Tue, Oct 22, 2019 at 08:33:27PM +0300, Eli Zaretskii wrote:
>> From: Ergus <[email-masked]>
>> Cc: [email-masked], [email-masked]
>> Date: Thu 01 Jan 1970 01:00:00 AM CET
>> > Window width changes are unrelated to line numbers, right?
>> >
>> > Is window-size-change-functions what you want?
>>
>> Yes they are unrelated, but the issue is the same...
>
>No, the issue is not the same.  When a window is resized, it is
>completely redrawn, and as part of that the line numbers are
>recalculated and redisplayed.  That's because line-number display is
>an inherent part of redisplay.
>
Hi:

I don't have too much time to be looking into this. But actually one of
the issues I had with the Stefan's solution is that sometimes I get:

Error adjusting window size: (wrong-type-argument wholenump 78.0)

Actually very often.

On the other hand, I am not sure that the fix will be needed in
lisp/window.el as it may affect many other things around.

Maybe we need the change in term.el itself as it seems to be the only
one with the issue. Otherwise the fix you made for tabulated-list.el
will be needed as a function in some other place we can access from
term-mode.

Could you please give a look into it?

>> Actually on a windows resize the term-line width is not updated
>> either. So the new outputs after that assume the same window width. The
>> line-number-width is just another side of the same problem where the
>> line-width is not recalculated..
>>
>> On window increase size the issue is not so annoying (it is not right,
>> but it works) but on window decrease size (or line-number-width
>> increase) it is worth because the lines adds a \ and break.
>>
>> So a right fix maybe should recalculate the line-width more dynamically
>> (for example when inserting RET in term mode)
>
>So is window-size-change-functions what you need to use to hook into
>the size changes?

Yes I suppose it is. But I have not clear how to use it :(.

Again,
Could you please give a look into it?
Please.