On Mon, Jan 14, 2019 at 09:02:44AM -0700, Todd C. Miller wrote:

> On Fri, 11 Jan 2019 08:23:36 +0100, Martijn van Duren wrote:
> 
> > I'm somewhat confident that this is the correct solution, but I'm
> > not 100% certain, considering Rapunzel probably has an easier time
> > untangling her hair.
> 
> I think all we really need to do is set SC_SCR_TOP so that the HMAP
> settings get refreshed while painting the screen.
> 
>  - todd
> 
> Index: usr.bin/vi/vi/vi.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/vi/vi/vi.c,v
> retrieving revision 1.21
> diff -u -p -u -r1.21 vi.c
> --- usr.bin/vi/vi/vi.c        18 Apr 2017 01:45:35 -0000      1.21
> +++ usr.bin/vi/vi/vi.c        14 Jan 2019 15:59:15 -0000
> @@ -395,6 +395,7 @@ intr:                     CLR_INTERRUPT(sp);
>               /* If the last command switched files, change focus. */
>               if (F_ISSET(sp, SC_FSWITCH)) {
>                       F_CLR(sp, SC_FSWITCH);
> +                     F_SET(sp, SC_SCR_TOP);
>                       (void)sp->gp->scr_rename(sp, sp->frp->name, 1);
>               }
>  
> 

A problem with this diff is that is changes the part of the screen
shown while switching back and forth between files with Ctrl-^

Normally, vi remembers both the cursor position in the files and the
part of the file shown (it does recenter in some cases). With this
diff, it the cursor remains at the correct line, but that part of the
file shown changes in a differnent way than before.

        -Otto


Reply via email to