-.\" $OpenBSD: vi.1,v 1.84 2024/02/12 16:42:42 job Exp $
+.\" $OpenBSD: vi.1,v 1.85 2024/04/24 15:15:40 job Exp $
.\"
.\" Copyright (c) 1994
.\" The Regents of the University of California. All rights reserved.
.\"
.\" @(#)vi.1 8.51 (Berkeley) 10/10/96
.\"
-.Dd $Mdocdate: February 12 2024 $
+.Dd $Mdocdate: April 24 2024 $
.Dt VI 1
.Os
.Sh NAME
.It Cm ruler Bq off
.Nm vi
only.
-Display a row/column ruler on the colon command line.
+Display a row/column/percentage ruler on the colon command line.
.It Cm scroll , scr Bq "($LINES \- 1) / 2"
Set the number of lines scrolled.
.It Cm searchincr Bq off
-/* $OpenBSD: vs_refresh.c,v 1.23 2024/02/12 16:42:43 job Exp $ */
+/* $OpenBSD: vs_refresh.c,v 1.24 2024/04/24 15:15:40 job Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
const char *t = NULL;
int ellipsis;
char *p, buf[20];
+ recno_t last;
/*
* It's possible that this routine will be called after sp->frp
cols = sp->cols - 1;
if (O_ISSET(sp, O_RULER)) {
vs_column(sp, &curcol);
- len = snprintf(buf, sizeof(buf), "%lu,%zu",
- (ulong)sp->lno, curcol + 1);
+
+ if (db_last(sp, &last))
+ len = snprintf(buf, sizeof(buf), "%lu,%zu",
+ (ulong)sp->lno, curcol + 1);
+ else
+ len = snprintf(buf, sizeof(buf), "%lu,%zu %lu%%",
+ (ulong)sp->lno, curcol + 1,
+ (unsigned long)(sp->lno * 100) / last);
midpoint = (cols - ((len + 1) / 2)) / 2;
if (curlen < midpoint) {