From f118762f9771ac64e1b8e0987be1eeddb663298a Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 28 Apr 2022 20:15:30 -0700 Subject: New + command to increase display height. --- pw.1 | 8 +++++++- pw.c | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/pw.1 b/pw.1 index 7fe38a4..c09bd2c 100644 --- a/pw.1 +++ b/pw.1 @@ -217,6 +217,12 @@ recall using the up and down arrow keys or and .BR Ctrl-N . +.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 \fBCtrl-Z\fI Suspends .IR pw , @@ -372,7 +378,7 @@ The program uses hard-coded ANSI sequences, so it doesn't support interesting old terminals. On the other hand, it carries no dependency on any terminal abstraction library/data. -The intervals and number of lines cannot be dynamically adjusted. +The intervals cannot be dynamically adjusted. There is no support for unwrapping long lines, which would be useful for copy and paste. diff --git a/pw.c b/pw.c index eb4c425..d695ad9 100644 --- a/pw.c +++ b/pw.c @@ -692,6 +692,16 @@ int main(int argc, char **argv) cmdbuf[1] = 0; curcmd = cmdbuf; break; + case '+': + if (ws.ws_row && maxlines >= ws.ws_row - 1) + break; + maxlines++; + if ((circbuf = realloc(circbuf, sizeof *circbuf * maxlines)) == 0) + panic("out of memory"); + if ((snapshot = realloc(snapshot, sizeof *snapshot * maxlines)) == 0) + panic("out of memory"); + snapshot[maxlines-1] = circbuf[maxlines-1] = 0; + break; } break; case kbd_esc: -- cgit v1.2.3