aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-05-11 07:13:21 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-05-11 07:13:21 -0700
commit13fcac0589e72c9c9ed43ec09ae514d3895d6bb5 (patch)
tree0fd26afee86edf6aba8c3a176ac1549f7300a42d
parent4dc7fe9854ca533ea4de84221061fb857b6e0dd4 (diff)
downloadpw-13fcac0589e72c9c9ed43ec09ae514d3895d6bb5.tar.gz
pw-13fcac0589e72c9c9ed43ec09ae514d3895d6bb5.tar.bz2
pw-13fcac0589e72c9c9ed43ec09ae514d3895d6bb5.zip
:p command resets any parameters not specified.
-rw-r--r--pw.13
-rw-r--r--pw.c4
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);
}