aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pw.121
-rw-r--r--pw.c31
2 files changed, 39 insertions, 13 deletions
diff --git a/pw.1 b/pw.1
index afaaa62..8c95cca 100644
--- a/pw.1
+++ b/pw.1
@@ -131,7 +131,14 @@ portion appears delimited by
When
.I pw
enters closed loop operation, the following single-key commands are
-available:
+available.
+
+The commands may be prefixed by a numeric argument, which is ignored by
+commands to which it is not applicable. The numeric argument is specified by
+entering digits, which are not echoed. The last 3 digits of the input are
+retained, so that the argument has an effective range from 0 to 999.
+
+The commands are:
.IP "\fBq\fP, \fBCtrl-C\fP"
Quit the program.
@@ -221,11 +228,13 @@ While the trigger pattern is being edited, the current trigger remains
in effect. Editing a trigger pattern may be canceled with
.BR ESC .
-.IP \fB+\fP
-Increases the display size by one line. This doesn't come into effect
-immediately; the newly opened position must be filled by a line of data
-from standard input. There is no way to reduce the size dynamically.
-Resizing beyond the terminal height is not permitted, if the height is known.
+.IP "[\fIcount\fP]\fB+\fP"
+Increases the display size by
+.I count
+lines, defaulting to 1. This doesn't come into effect immediately; the newly
+opened position must be filled by a line of data from standard input. There is
+no way to reduce the size dynamically. Resizing is limited to the terminal
+height, if the height is known.
.IP \fBCtrl-Z\fI
Suspends
diff --git a/pw.c b/pw.c
index 1fe30cf..9960e5a 100644
--- a/pw.c
+++ b/pw.c
@@ -672,7 +672,8 @@ int main(int argc, char **argv)
for (unsigned stat = stat_dirty, hpos = 0,
kbd_state = kbd_cmd, kbd_prev = kbd_cmd, lasttime = ~0U,
- workbout = 1024, work = workbout, histpos = 0;
+ workbout = 1024, work = workbout, histpos = 0,
+ cmdcount = UINT_MAX;
kbd_state != kbd_exit ;)
{
int force = 0, nfds = 2, pollms = poll_interval;
@@ -880,14 +881,28 @@ int main(int argc, char **argv)
curcmd = cmdbuf;
break;
case '+':
- if (ws.ws_row && maxlines >= ws.ws_row - 1)
+ if (ws.ws_row && maxlines >= ws.ws_row - 1) {
break;
- circbuf = resizebuf(circbuf, maxlines, maxlines + 1);
- snapshot = resizebuf(snapshot, maxlines, maxlines + 1);
- maxlines++;
- if (maxlines == ws.ws_row - 1)
- maxed = 1;
+ } else {
+ unsigned count = (cmdcount == UINT_MAX) ? 1 : cmdcount;
+
+ maxlines += count;
+
+ if (maxlines >= ws.ws_row - 1) {
+ maxed = 1;
+ maxlines = ws.ws_row - 1;
+ }
+
+ circbuf = resizebuf(circbuf, maxlines, maxlines + 1);
+ snapshot = resizebuf(snapshot, maxlines, maxlines + 1);
+ }
break;
+ default:
+ if (isdigit(ch)) {
+ if (cmdcount == UINT_MAX)
+ cmdcount = 0;
+ cmdcount = (cmdcount * 10 + (ch - '0')) % 1000;
+ }
}
break;
case kbd_esc:
@@ -979,6 +994,7 @@ int main(int argc, char **argv)
}
kbd_state = kbd_cmd;
curcmd = 0;
+ cmdcount = UINT_MAX;
break;
case BS: case DEL:
{
@@ -986,6 +1002,7 @@ int main(int argc, char **argv)
if (len == 1) {
kbd_state = kbd_cmd;
curcmd = 0;
+ cmdcount = UINT_MAX;
} else {
cmdbuf[--len] = 0;
}