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: Marco Diego Aurélio Mesquita
Subject: Re: having a scroll bar also in softwrap mode
Date: Fri, 1 May 2020 13:11:32 -0300

Attached is an updated version of my patch. I applies on top of your
v3 rebased to current master.

It includes some fixes:
  - Correctly update the scrollbar when buffer is scrolled;
  - Correctly draw the scrollbar on the end of a line;
  - Not allowing the scrollbar to go out of sight on overscrolled buffers.

On Thu, Apr 30, 2020 at 9:35 AM Benno Schulenberg <address@hidden> wrote:
>
>
> 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.
>

This problem is caused by the variable is_shorter getting out of sync
with buffer contents. The updated version of the patch fixes it by
replacing the condition (is_shorter && thebar) with (thebar), but I
think the proper solution is to replace the global var is_shorter with
a function.

> 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.
>

Fixed.

> > +     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.
>

Fixed, but as said above, may need a bit more work.

> >       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.
>

Fixed after rebase.

Please, review it.

Attachment: 0001-Initial-softwrap-support-for-scrollbar.patch
Description: Text Data


reply via email to

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