From 1965dfa1525950cf4efc96a16613734d65ea0dc0 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 6 May 2022 08:00:06 -0700 Subject: New { } commands to reposition middle pane origin. --- pw.1 | 14 ++++++++++++++ pw.c | 12 ++++++++++++ 2 files changed, 26 insertions(+) diff --git a/pw.1 b/pw.1 index d12b4a9..e043e0b 100644 --- a/pw.1 +++ b/pw.1 @@ -214,6 +214,20 @@ can be adjusted without affecting what portion of the line it shows, independently of any horizontal scrolling adjustments occurring in the right pane. +.IP "[\fIcount\fP]\fB{\fP, [\fIcount\fP]\fB}\fP" +Adjust what portion of line is visible in the middle pane, incrementing +or decrementing the viewport origin by +.I count +characters, defaulting to one, without changing the width. +The effect is that the content of the middle pane appears to +scroll horizontally to the right when +.B } +is used, or left when +.B { +is used. +When no middle pane is being shown, these commands have no effect other +than refreshing the display. + .IP "\fBCtrl-I, Tab\fP" Toggle the highlighting of separator characters appearing in the line display. The when toggled on, the diff --git a/pw.c b/pw.c index 41c8516..3bd77fe 100644 --- a/pw.c +++ b/pw.c @@ -1233,6 +1233,18 @@ int main(int argc, char **argv) pw.vsplit2 = max(0, pw.vsplit2 - (int) cmdcount); pw.stat |= stat_force; break; + case '}': + if (cmdcount == UINT_MAX) + cmdcount = 1; + pw.vs2pos = min((int) maxlen, pw.vs2pos + (int) cmdcount); + pw.stat |= stat_force; + break; + case '{': + if (cmdcount == UINT_MAX) + cmdcount = 1; + pw.vs2pos = max(0, pw.vs2pos - (int) cmdcount); + pw.stat |= stat_force; + break; case ctrl('i'): pw.stat ^= stat_hlite; pw.stat |= stat_force; -- cgit v1.2.3