This also fixes the bug where if you split the window then open a file
in one pane, the line number in the other (original file) pane
increments.  I have tried (without success) more than once to figure
out what was causing this.

Thanks for the fix!

-ken

On Fri, Sep 8, 2017 at 11:24 PM, Martin Wanvik
<[email protected]> wrote:
> When inserting a newline, only increment dotline for windows that are
> displaying the same buffer as the current one.
>
> Index: usr.bin/mg/line.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/mg/line.c,v
> retrieving revision 1.58
> diff -u -p -u -r1.58 line.c
> --- usr.bin/mg/line.c   11 Dec 2015 20:21:23 -0000      1.58
> +++ usr.bin/mg/line.c   9 Sep 2017 01:36:02 -0000
> @@ -264,7 +264,8 @@ lnewline_at(struct line *lp1, int doto)
>                 for (wp = wheadp; wp != NULL; wp = wp->w_wndp) {
>                         if (wp->w_linep == lp1)
>                                 wp->w_linep = lp2;
> -                       if (wp->w_dotline >= tcurwpdotline)
> +                       if (wp->w_dotline >= tcurwpdotline &&
> +                           wp->w_bufp == curwp->w_bufp)
>                                 wp->w_dotline++;
>                 }
>                 undo_add_boundary(FFRAND, 1);
> @@ -292,7 +293,8 @@ lnewline_at(struct line *lp1, int doto)
>                         wp->w_dotp = lp2;
>                         wp->w_doto -= doto;
>                         wp->w_dotline++;
> -               } else if (wp->w_dotline > tcurwpdotline)
> +               } else if (wp->w_dotline > tcurwpdotline &&
> +                   wp->w_bufp == curwp->w_bufp)
>                         wp->w_dotline++;
>                 if (wp->w_markp == lp1 && wp->w_marko >= doto) {
>                         wp->w_markp = lp2;
>

Reply via email to