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: Thu, 30 Apr 2020 14:34:52 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

Op 30-04-2020 om 03:51 schreef Marco Diego Aurélio Mesquita:
> Attached is an updated patch. It behaves correctly on my quick tests.
> 
> The for(int i = x; i < COLS - 1; i++) wprintw(edit, " "); is a hack.
> For some unknown reason, wclrtoeol(edit) erases every thing to the end
> of line (include scrollbar) even if mvwaddch(edit, row, COLS - 1,
> bardata[row]); is performed later.

That's because you have somehow incompletely applied V3 of my version
of the scrollbar patch.  Your patch fails to apply cleanly (fuzz 1) on
top of mine.

After correcting that, I've applied and run your patch.

> I modified draw_scrollbar function since the divisions were giving
> some wrong results (probably because of rounding errors). If you want
> to reproduce this problem, just press enter until a single line is
> scrolled; then press up until the scrollbar rolls up: it will be
> filled instead of having a free lowest slot.

To borrow your recipe: in an empty buffer, hold <Enter> until three
lines are scrolled off the top (use --line to easily see this).  Then
hold <Alt+Down> until the scrolling stops.  Notice that the scroll bar
is now empty.  Type <Alt+Up> three times.  Only on the third keystroke
does the scroll bar reappear.  This is not right: even when only one
row of the buffer is visible in the viewport, there should be at least
one visible block in the scroll bar.

> +     if (is_shorter || ISSET(SOFTWRAP)) {
> +             int x, y;
> +             getyx(edit, y, x);
> +             for(int i = x; i < COLS - 1; i++)
> +                     wprintw(edit, " ");
> +     }

Remove this hunk; it's not needed when you properly apply V3 first.

>       for (int row = 0; row < editwinrows; row++) {
>               if (row >= lowest && row <= highest)

That last line should begin with "bardata[row] = ' '...".  If you
don't set bardata, you can't expect it to be drawn correctly later.

Benno

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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