aboutsummaryrefslogtreecommitdiffstats
path: root/pw.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-05-08 20:15:16 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-05-08 20:15:16 -0700
commit327a2242901a4c52cbd1130a1d155584549f877c (patch)
tree9a5fc34c910f09855fe0fdce6ef1698c1575195f /pw.c
parentc91333deea98660aea85dbb525933a6f198415cb (diff)
downloadpw-327a2242901a4c52cbd1130a1d155584549f877c.tar.gz
pw-327a2242901a4c52cbd1130a1d155584549f877c.tar.bz2
pw-327a2242901a4c52cbd1130a1d155584549f877c.zip
Ctrl-G shows a few flags also, and -p restores them.
Diffstat (limited to 'pw.c')
-rw-r--r--pw.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/pw.c b/pw.c
index 96ad94e..2d9aca6 100644
--- a/pw.c
+++ b/pw.c
@@ -80,6 +80,7 @@ enum status_flags {
stat_bkgnd = 0x0200, // running in the background
stat_hlite = 0x0400, // running in the background
stat_oneshot = 0x0800, // running in the background
+ stat_save = stat_susp | stat_lino | stat_hlite
};
typedef enum execode {
@@ -1161,9 +1162,10 @@ int main(int argc, char **argv)
{
char *err;
char *hpos = strtok(optarg, ", \t");
- char *lpane = hpos ? strtok(0, ", \t") : 0;
- char *rpane = lpane ? strtok(0, ", \t") : 0;
- char *vs2pos = rpane ? strtok(0, ", \t") : 0;
+ char *lpane = strtok(0, ", \t");
+ char *rpane = strtok(0, ", \t");
+ char *vs2pos = strtok(0, ", \t");
+ char *flags = strtok(0, ", \t");
if (hpos) {
if ((pw.hpos = getznn(hpos, &err)) < 0)
@@ -1188,6 +1190,14 @@ int main(int argc, char **argv)
error("-%c option: bad right pane view offset %s: %s\n",
opt, vs2pos, err);
}
+
+ if (flags) {
+ int stat = getznn(flags, &err);
+ if (stat < 0)
+ error("-%c option: bad flags %s: %s\n",
+ opt, flags, err);
+ pw.stat = stat & stat_save;
+ }
}
break;
case 'e':
@@ -1659,8 +1669,9 @@ int main(int argc, char **argv)
pw.stat |= stat_force;
break;
case ctrl('g'):
- snprintf(pw.cmdbuf, sizeof pw.cmdbuf, "-p %d,%d,%d,%d",
- pw.hpos, pw.vsplit1, pw.vsplit2, pw.vs2pos);
+ snprintf(pw.cmdbuf, sizeof pw.cmdbuf, "-p %d,%d,%d,%d,%d",
+ pw.hpos, pw.vsplit1, pw.vsplit2, pw.vs2pos,
+ (int) pw.stat & stat_save);
pw.curcmd = pw.cmdbuf;
kbd_state = kbd_result;
break;