Hi Bram,

A second small patch.  This time I noticed that even though my cursor was
on a line near the top of a window, when I resized the window down to two
lines, it ended up at the bottom of the window.  This is another new bug
since the last vim I used.

Again, I just had to revert a change to my code.  I have no idea why
someone would have made that change.  It appears to have been changed for
some purpose, but all it does is introduce this bug.

Subject: [PATCH 2/2] Fixed cursor line near top of window ending up at
bottom
 of window after resizing down to two lines.

---
 src/window.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/window.c b/src/window.c
index d5d67999c..48e343263 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5786,8 +5786,7 @@ scroll_to_fraction(win_T *wp, int prev_height)
     lnum = wp->w_cursor.lnum;
     if (lnum < 1)        /* can happen when starting up */
         lnum = 1;
-    wp->w_wrow = ((long)wp->w_fraction * (long)height - 1L
-                     + FRACTION_MULT / 2) / FRACTION_MULT;
+    wp->w_wrow = ((long)wp->w_fraction * (long)height - 1L) /
FRACTION_MULT;
     line_size = plines_win_col(wp, lnum, (long)(wp->w_cursor.col)) - 1;
     sline = wp->w_wrow - line_size;

-- 
2.19.1.windows.1



On Sun, 24 Feb 2019 at 17:55, Robert Webb <[email protected]> wrote:

>
> On Thu, 21 Feb 2019 at 23:28, Bram Moolenaar <[email protected]> wrote:
>
>>
>> > After finally upgrading for the first time in 9 or so years, I notice
>> just
>> > a couple of minor issues:
>> >
>> > * When files have been changed externally, and vim regains focus, it
>> still
>> > only asks whether to load or ignore them one at a time.  I often have
>> lots
>> > of changes at once, eg I switch to another branch or just pull the
>> latest
>> > code.  Was hoping after 9 years there might be a "load all" option.
>>
>> Or "all but one"?  Problem is that you would have to look at each file
>> to avoid reloading one that you wanted to keep.  Perhaps a "load all
>> that I didn't change"?
>>
>
> Yes, of course it should only reload files that have been changed
> externally.
>
> The issue Christian pointed to seems to be the same issue, but with a
> better suggestion.  To add an "Apply to all" tickbox, so either "Load" or
> "Ignore" could be used to apply to all.  I don't know if vim can easily add
> tickboxes programmatically though to dialogs like this.
>
> https://github.com/vim/vim/issues/3688
>
>
>>
>> > * Bug: resize windows by dragging the divider between them down to a
>> single
>> > line.  The window directly above the divider is fine (as it has focus),
>> but
>> > windows higher up that are reduced to a single line, or windows below
>> that
>> > are reduced to a single line, don't end up showing the line with the
>> > cursor.  They are one away from it.  As soon as you move the mouse over
>> > them they update to correctly show the cursor line.  This is kind of
>> > annoying.  Aside from seeing something change out of the corner of your
>> eye
>> > as the mouse moves and wondering what happened, I also often want to see
>> > that one line.  I often reduce a window down to one important line I
>> want
>> > to see while working in another window.
>> >
>> > I'm using gvim on Windows, 8.1, patches 1-897.
>>
>> It's very likely the code to keep the cursor in the same relative
>> position. Hmm, I wonder who wrote that?  :-)
>>
>
> Well it worked when I wrote it :)
>
> I had a quick look and found the problem quickly by comparing the old and
> new code.
>
> Problem was that the call to set_topline() had been moved into the two
> if-branches, so it didn't get called any more when sline == 0.
>
> Do you think that was done to fix some other issue though, or just because
> it was presumed more efficient?
>
> Patch below fixes the bug.  Is this the right way to supply patches?
>
> Subject: [PATCH] Fixed bug where resizing a non-current window down to a
>  single line would not show the cursor line, but a line one away from it.
>
> ---
>  src/window.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/src/window.c b/src/window.c
> index f6e611535..d5d67999c 100644
> --- a/src/window.c
> +++ b/src/window.c
> @@ -5823,7 +5823,6 @@ scroll_to_fraction(win_T *wp, int prev_height)
>              --wp->w_wrow;
>          }
>          }
> -        set_topline(wp, lnum);
>      }
>      else if (sline > 0)
>      {
> @@ -5868,9 +5867,8 @@ scroll_to_fraction(win_T *wp, int prev_height)
>          lnum = 1;
>          wp->w_wrow -= sline;
>          }
> -
> -        set_topline(wp, lnum);
>      }
> +    set_topline(wp, lnum);
>      }
>
>      if (wp == curwin)
> --
> 2.19.1.windows.1
>
>
>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui