From 13fcac0589e72c9c9ed43ec09ae514d3895d6bb5 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 11 May 2022 07:13:21 -0700 Subject: :p command resets any parameters not specified. --- pw.1 | 3 ++- pw.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pw.1 b/pw.1 index 08c4401..21a6d56 100644 --- a/pw.1 +++ b/pw.1 @@ -672,7 +672,8 @@ will have to occur again before the next automatic suspension. .IP "\fB:p\fP [\fIinteger\fP[,\fIinteger\fP[,\fIinteger\fP[,\fIinteger\fP[,\fIinteger\fP]]]]] Sets the display parameters, exactly in the manner of the .B -p -option. +option. Any parameters not specified are reset to their default initial values: +zero in the case of character positions, off in the case of flags. .IP "\fB:s\fP [\fIfilename\fP]" Save a snapshot of the configuration state to the specified file. diff --git a/pw.c b/pw.c index 1c77191..674a710 100644 --- a/pw.c +++ b/pw.c @@ -683,6 +683,9 @@ static int decodeparms(pwstate *pw, char *parms, char *vs2pos = strtok(0, ", \t"); char *flags = strtok(0, ", \t"); + pw->hpos = pw->vsplit1 = pw->vsplit2 = pw->vs2pos = 0; + pw->stat &= ~stat_save; + if (hpos && (pw->hpos = getznn(hpos, &err)) < 0) { snprintf(resbuf, size, "bad horizontal scroll offset %s: %s\n", hpos, err); return 0; @@ -709,7 +712,6 @@ static int decodeparms(pwstate *pw, char *parms, snprintf(resbuf, size, "bad flags %s: %s\n", flags, err); return 0; } - pw->stat &= ~stat_save; pw->stat |= (stat & stat_save); } -- cgit v1.2.3