aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pw.110
-rw-r--r--pw.c28
2 files changed, 38 insertions, 0 deletions
diff --git a/pw.1 b/pw.1
index 1cc8bc7..0738873 100644
--- a/pw.1
+++ b/pw.1
@@ -289,6 +289,16 @@ is shown followed by the list of triggers in parentheses.
Patterns which have a position other than 1 are preceded by
the position shown in square brackets.
+.IP "[\fIcount\fP]\fBa\fP, [\fIcount\fP]\fBd\fP"
+Advance or delay the currently active triggers by
+.I count
+lines, defaulting to 1. Advancing means that all of the triggers are assigned
+to more recently received lines closer to the head of the FIFO.
+on earlier data. Delaying is the opposite: the triggers are assigned to
+less recently received items, closer to the tail of the FIFO.
+The advance/delay commands will not move any trigger to a position which
+corresponds to a line that is not displayed.
+
.IP "[\fIcount\fP]\fB+\fP"
Increases the display size by
.I count
diff --git a/pw.c b/pw.c
index 4c25464..81494de 100644
--- a/pw.c
+++ b/pw.c
@@ -909,6 +909,34 @@ int main(int argc, char **argv)
cmdbuf[1] = 0;
curcmd = cmdbuf;
break;
+ case 'a': case 'd':
+ if ((stat & (stat_htmode | stat_ttmode))) {
+ int step = ((((stat & stat_htmode) && ch == 'a') ||
+ ((stat & stat_ttmode) && ch == 'd'))
+ ? -1 : 1);
+
+ if (cmdcount == UINT_MAX)
+ cmdcount = 1;
+
+ if (step < 0) {
+ for (; cmdcount && !triglist[0]; cmdcount --) {
+ memmove(triglist, triglist + 1,
+ (maxtrig - 1) * sizeof *triglist);
+ triglist[maxtrig - 1] = 0;
+ }
+ } else if (nlines <= maxtrig) {
+ for (; (cmdcount &&
+ !triglist[nlines - 1] &&
+ !triglist[maxtrig - 1]);
+ cmdcount --)
+ {
+ memmove(triglist + 1, triglist,
+ (maxtrig - 1) * sizeof *triglist);
+ triglist[0] = 0;
+ }
+ }
+ }
+ break;
case '+':
if (ws.ws_row && maxlines >= ws.ws_row - 1) {
break;