From 0ef429135140295ded624010eb5e5e906eac5996 Mon Sep 17 00:00:00 2001 From: "Steffen (Daode) Nurpmeso" Date: Thu, 6 Oct 2016 14:04:58 +0200 Subject: [PATCH] `z': add ^: goes to first screen; fix max calc for 0 modulos --- cmd1.c | 12 +++++++++++- nail.1 | 33 ++++++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/cmd1.c b/cmd1.c index b6a154c6..b1e017ca 100644 --- a/cmd1.c +++ b/cmd1.c @@ -723,14 +723,24 @@ a_cmd_scroll(char const *arg, bool_t onlynew){ int msgspec, size, maxs; NYD2_ENTER; + /* TODO scroll problem: we do not know whether + and $ have already reached + * TODO the last screen in threaded mode */ msgspec = onlynew ? -1 : 0; size = screensize(); - maxs = msgCount / size; + if((maxs = msgCount / size) > 0 && msgCount % size == 0) + --maxs; switch(*arg){ case '\0': ++_screen; goto jfwd; + case '^': + if(arg[1] != '\0') + goto jerr; + if(_screen == 0) + goto jerrbwd; + _screen = 0; + break; case '$': if(arg[1] != '\0') goto jerr; diff --git a/nail.1 b/nail.1 index da1de9b5..baa9aad4 100644 --- a/nail.1 +++ b/nail.1 @@ -965,6 +965,12 @@ can be adjusted through the variable .Va headline and the possible sorting criterion via .Va autosort . +Scrolling through +.Va screen Ns +fuls of +.Ic headers +can be performed with the command +.Ic z . If the initially opened mailbox is empty \*(UA will instead exit immediately (after displaying a message) unless the variable .Va emptystart @@ -5208,20 +5214,29 @@ No special handling of compressed files is performed. . .Mx .It Ic z -\*(UA presents message headers in windowfuls as described under the +\*(UA presents message headers in +.Va screen Ns +fuls as described under the .Ic headers command. -This command scrolls to the next window of messages. -If an argument is given, it specifies the window to use. -A number prefixed by +Without arguments this command scrolls to the next window of messages, +likewise if the argument is +.Ql + . +An argument of +.Ql - +scrolls to the last, +.Ql ^ +scrolls to the first, and +.Ql $ +to the last +.Va \&\&screen +of messages. +A number argument prefixed by .Ql + or .Ql \- -indicates that the window is calculated in relation to the current position. -A number without a prefix specifies an absolute window number, -and a -.Ql $ -lets \*(UA scroll to the last window of messages. +indicates that the window is calculated in relation to the current +position, and a number without a prefix specifies an absolute position. . .Mx .It Ic Z -- 2.11.4.GIT