nano-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 2/4 V7] display: support the scroll bar also when --softwrap


From: Benno Schulenberg
Subject: Re: [PATCH 2/4 V7] display: support the scroll bar also when --softwrap is used
Date: Sun, 31 May 2020 15:06:45 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0

Op 31-05-2020 om 01:55 schreef Marco Diego Aurélio Mesquita:
> I think there is a problem with this approach. See: calculating
> chunk_nr depends on:
>     extra_chunks_in, which depends on
>     get_chunk_and_edge, which depends on
>     get_softwrap_breakpoint, which needs
>     editwincols, which is only correctly calculated on confirm_margin.
> 
> This can be fixed by condionationally (if (ISSET(SOFTWRAP))) calling
> renumber_from(openfile_edittop) after refresh_needed = TRUE on
> confirm_margin.

To keep things together, the conditional call of renumber_from() should
happen before 'refresh_needed = TRUE', inside the existing #ifndef.

> I also think the buffer should be renumbered when the terminal is resized.

True...

Thinking about it, when softwrap is on, renumber_from() needs to be called
whenever ensure_firstcolumn_is_aligned() is called.  The only time renumbering
is not needed is when that function is called in inject(), when 'thisline ==
openfile->edittop'.  But that condition will not trigger very often, as mostly
one edits somewhere in the middle of the screen.  So... I think to move the
renumber_from(openfile->filetop) to inside ensure_firstcolumn_is_aligned().
That will also catch the cases of (un)indenting or (un)commenting some lines
and changing the number of chunks in at least one of those lines.

Stacked patch is coming up.

Benno

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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