AmendHub

Download:

jcs

/

subtext

/

amendments

/

518

session: Fix off-by-one in session_paginate

When breaking on existing newlines, this was sending the \r of \r\n
to session_output, so we were writing "line\r\r\n" which on some
terminals produced an extra blank line in between each line output.

jcs made amendment 518 about 1 year ago
--- session.c Thu Jun 15 09:48:09 2023 +++ session.c Wed Aug 2 11:08:24 2023 @@ -606,12 +606,14 @@ session_paginate(struct session *session, const char * while (len && !session->ending) { for (n = 0, adv = 0; n < line_len && n < len; n++) { if (str[n] == '\r') { - adv = last_space = n + 1; + last_space = n; + adv = n + 1; if (str[n + 1] == '\n') adv++; break; } else if (str[n] == '\n') { - adv = last_space = n + 1; + last_space = n; + adv = n + 1; break; } else if (str[n] == ' ') { adv = last_space = n + 1;