diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-05-08 23:02:54 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-05-08 23:02:54 -0700 |
commit | 3be6a458fd8ee9b11112cac61bbdbec2d0b2b101 (patch) | |
tree | 43c50ce8854fc2c63435eae3ecc5d18a5d211adb /pw.c | |
parent | 508abff2b860297cd753324fe1dde48a64838455 (diff) | |
download | pw-3be6a458fd8ee9b11112cac61bbdbec2d0b2b101.tar.gz pw-3be6a458fd8ee9b11112cac61bbdbec2d0b2b101.tar.bz2 pw-3be6a458fd8ee9b11112cac61bbdbec2d0b2b101.zip |
New :p command; :s saves display params too.
Diffstat (limited to 'pw.c')
-rw-r--r-- | pw.c | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -709,17 +709,18 @@ static int decodeparms(pwstate *pw, char *parms, snprintf(resbuf, size, "bad flags %s: %s\n", flags, err); return 0; } - pw->stat = stat & stat_save; + pw->stat &= ~stat_save; + pw->stat |= (stat & stat_save); } return 1; } -static execode execute(pwstate *pw, const char *cmd, char *resbuf, +static execode execute(pwstate *pw, char *cmd, char *resbuf, size_t size, int count) { execode res = exec_failed; - const char *arg = cmd + 2 + strspn(cmd + 2, " \t"); + char *arg = cmd + 2 + strspn(cmd + 2, " \t"); clrline(0); @@ -874,6 +875,14 @@ static execode execute(pwstate *pw, const char *cmd, char *resbuf, res = exec_ok; } break; + case 'p': + { + if (decodeparms(pw, arg, resbuf, size)) { + pw->stat |= stat_force; + res = exec_ok; + } + } + break; case 's': { int rflg = 0; @@ -889,6 +898,9 @@ static execode execute(pwstate *pw, const char *cmd, char *resbuf, break; } + fprintf(f, ":p%d,%d,%d,%d,%d\n", pw->hpos, pw->vsplit1, pw->vsplit2, + pw->vs2pos, (int) pw->stat & stat_save); + if (pw->tcount) fprintf(f, ":f%d\n", pw->tcount); if (pw->sncount) @@ -998,7 +1010,7 @@ static execode execute(pwstate *pw, const char *cmd, char *resbuf, return res; } -static execode batchexe(pwstate *pw, const char *cmd, char *resbuf, size_t size) +static execode batchexe(pwstate *pw, char *cmd, char *resbuf, size_t size) { size_t ndigits = strspn(cmd, "0123456789"); int count = 0; |