Count number of lines (and not messages) in 'more'.
This commit is contained in:
parent
c0973621bc
commit
9c46ad8e2f
1 changed files with 13 additions and 7 deletions
|
@ -333,17 +333,18 @@ static void
|
||||||
server_got_reply(char *x)
|
server_got_reply(char *x)
|
||||||
{
|
{
|
||||||
int code;
|
int code;
|
||||||
|
int len = 0;
|
||||||
|
|
||||||
if (*x == '+') /* Async reply */
|
if (*x == '+') /* Async reply */
|
||||||
skip_input || printf(">>> %s\n", x+1);
|
skip_input || (len = printf(">>> %s\n", x+1));
|
||||||
else if (x[0] == ' ') /* Continuation */
|
else if (x[0] == ' ') /* Continuation */
|
||||||
skip_input || printf("%s%s\n", verbose ? " " : "", x+1);
|
skip_input || (len = printf("%s%s\n", verbose ? " " : "", x+1));
|
||||||
else if (strlen(x) > 4 &&
|
else if (strlen(x) > 4 &&
|
||||||
sscanf(x, "%d", &code) == 1 && code >= 0 && code < 10000 &&
|
sscanf(x, "%d", &code) == 1 && code >= 0 && code < 10000 &&
|
||||||
(x[4] == ' ' || x[4] == '-'))
|
(x[4] == ' ' || x[4] == '-'))
|
||||||
{
|
{
|
||||||
if (code)
|
if (code)
|
||||||
skip_input || printf("%s\n", verbose ? x : x+5);
|
skip_input || (len = printf("%s\n", verbose ? x : x+5));
|
||||||
if (x[4] == ' ')
|
if (x[4] == ' ')
|
||||||
{
|
{
|
||||||
nstate = STATE_PROMPT;
|
nstate = STATE_PROMPT;
|
||||||
|
@ -352,15 +353,20 @@ server_got_reply(char *x)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
skip_input || printf("??? <%s>\n", x);
|
skip_input || (len = printf("??? <%s>\n", x));
|
||||||
|
|
||||||
if (skip_input)
|
if (skip_input)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
num_lines++;
|
if (interactive && input_initialized && (len > 0))
|
||||||
if (interactive && input_initialized && (num_lines >= LINES) && (cstate == STATE_CMD_SERVER))
|
{
|
||||||
|
int lns = LINES ? LINES : 25;
|
||||||
|
int cls = COLS ? COLS : 80;
|
||||||
|
num_lines += (len + cls - 1) / cls; /* Divide and round up */
|
||||||
|
if ((num_lines >= lns) && (cstate == STATE_CMD_SERVER))
|
||||||
more();
|
more();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
server_read(void)
|
server_read(void)
|
||||||
|
|
Loading…
Reference in a new issue