From b459e1dc778beb6e06186f53ffeaea339c877667 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 24 Jan 2019 15:09:42 +0000 Subject: Fix a crash on long lines when switching to another file by setting SC_SCR_CENTER which will cause the offsets in HMAP to be reset when painting the screen. OK martijn@ otto@ --- usr.bin/vi/vi/vi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'usr.bin/vi') diff --git a/usr.bin/vi/vi/vi.c b/usr.bin/vi/vi/vi.c index a8bfec9356d..9059ffe10e6 100644 --- a/usr.bin/vi/vi/vi.c +++ b/usr.bin/vi/vi/vi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vi.c,v 1.21 2017/04/18 01:45:35 deraadt Exp $ */ +/* $OpenBSD: vi.c,v 1.22 2019/01/24 15:09:41 millert Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -395,6 +395,8 @@ intr: CLR_INTERRUPT(sp); /* If the last command switched files, change focus. */ if (F_ISSET(sp, SC_FSWITCH)) { F_CLR(sp, SC_FSWITCH); + F_CLR(sp, SC_SCR_TOP); + F_SET(sp, SC_SCR_CENTER); (void)sp->gp->scr_rename(sp, sp->frp->name, 1); } -- cgit v1.2.3