From: Job Snijders Subject: Re: usr.bin/vi: add 'are we there yet' indicator to the ruler To: "Todd C. Miller" Cc: tech@openbsd.org Date: Thu, 25 Apr 2024 01:32:24 +0000 On Wed, Apr 24, 2024 at 07:06:29PM -0600, Todd C. Miller wrote: > No objection from me but it would be nice to keep the nvi2 port in > sync if possible. Would you be willing to create a PR with this > change at https://github.com/lichray/nvi2 Yes, was on my todo list for if/after it landed in OpenBSD. https://github.com/lichray/nvi2/pull/131 While there, don't divide by zero (for example, when you make a new empty file by starting just 'vi') OK? Index: vi/vs_refresh.c =================================================================== RCS file: /cvs/src/usr.bin/vi/vi/vs_refresh.c,v diff -u -p -r1.24 vs_refresh.c --- vi/vs_refresh.c 24 Apr 2024 15:15:40 -0000 1.24 +++ vi/vs_refresh.c 25 Apr 2024 01:28:06 -0000 @@ -859,7 +859,7 @@ vs_modeline(SCR *sp) if (O_ISSET(sp, O_RULER)) { vs_column(sp, &curcol); - if (db_last(sp, &last)) + if (db_last(sp, &last) || last == 0) len = snprintf(buf, sizeof(buf), "%lu,%zu", (ulong)sp->lno, curcol + 1); else