nano-devel
[Top][All Lists]
Advanced

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

Re: having a scroll bar also in softwrap mode


From: Benno Schulenberg
Subject: Re: having a scroll bar also in softwrap mode
Date: Sat, 9 May 2020 10:41:39 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

Op 07-05-2020 om 22:58 schreef Marco Diego Aurélio Mesquita:
> Are you suggesting to renumber the buffer in redecorate_after_swtich
> on the codition if (ISSET(SOFTWRAP)) ? If that is the case, then this
> means there will be a renumbering every time buffers are switched,
> right?

Only when softwrap is on, which will not be the case for most people.
Also, using softwrapping is slow anyway, so it doesn't matter much if
it gets a bit slower.  The important thing is that the default case,
the non-softwrap case, doesn't get slower.

> I think
> there is an alternative: when SOFTWRAP is toggled, renumber only when
> it is turned on and add a check in draw_scrollbar:
> 
>   if (!ISSET(SCROLLBAR)) {
>     totalrows = openfile->filebot->lineno;
>     first_row = openfile->edittop->lineno;
>   }

The other way around, of course: the non-softwrap case should not be
burdened with computations that are only needed for softwrapping.

> I'm happy to see that we are finally getting close to something
> acceptable.

Far from it.  I don't like it that renumber_from() is burdened with
something that is only needed for softwrapping.  Probably the chunk
numbering should only be done in the softwrap case...

> +     if (old_amount != number_of_chunks_in(openfile->current))
> +             renumber_from(openfile->current);

Of course also this code should not be included in the tiny version.
When I make a remark about anything (in this case #ifdefs), apply it
_everywhere_.


> +                     if (!ISSET(SOFTWRAP))
>                               openfile->firstcolumn = 0;
> -                     } else
> -                             thebar  = 0;
> +
> +                     thebar = (LINES > 5 && COLS > 9) ? 1 : 0;
> +                     bardata = nrealloc(bardata, LINES * sizeof(int));
>                       editwincols = COLS - margin - thebar;
> +                     if(ISSET(SOFTWRAP))
> +                             renumber_from(openfile->filetop);

Come on.  There is already an 'if !softwrap' five lines back.  Use it!
Also: whitespace again.

To save myself more explaining, an edited patch is attached.

Benno

Attachment: 0001-display-an-attempt-to-support-the-scroll-bar-also-wi.patch
Description: Text Data

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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