diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-04-30 14:29:13 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-04-30 14:29:13 -0700 |
commit | f46115c8fbef8b68bdb426cf7d25ba84b864cdbe (patch) | |
tree | deadd70bdfb8eda7c37eb1f329fcb23580af016b | |
parent | 76d200dd7f1266bb274d5d792d7645b456bc581a (diff) | |
download | pw-f46115c8fbef8b68bdb426cf7d25ba84b864cdbe.tar.gz pw-f46115c8fbef8b68bdb426cf7d25ba84b864cdbe.tar.bz2 pw-f46115c8fbef8b68bdb426cf7d25ba84b864cdbe.zip |
New a, d commands to advance or delay triggers.
-rw-r--r-- | pw.1 | 10 | ||||
-rw-r--r-- | pw.c | 28 |
2 files changed, 38 insertions, 0 deletions
@@ -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 @@ -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; |