diff options
-rw-r--r-- | src/ansi.c | 2 | ||||
-rw-r--r-- | src/fileio.c | 2 | ||||
-rw-r--r-- | src/mark.c | 9 | ||||
-rw-r--r-- | src/resize.c | 2 | ||||
-rw-r--r-- | src/window.h | 1 |
5 files changed, 12 insertions, 4 deletions
@@ -2906,6 +2906,8 @@ struct mline *ml; if (++wp->w_histidx >= wp->w_histheight) wp->w_histidx = 0; + if (wp->w_scrollback_height < wp->w_histheight) + ++wp->w_scrollback_height; } #endif diff --git a/src/fileio.c b/src/fileio.c index b084edd..14bb9b1 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -458,7 +458,7 @@ void WriteFile(struct acluser *user, char *fn, int dump) { } if (dump == DUMP_SCROLLBACK) { #ifdef COPY_PASTE - for (i = 0; i < fore->w_histheight; i++) { + for (i = fore->w_histheight - fore->w_scrollback_height; i < fore->w_histheight; i++) { p = (char *)(WIN(i)->image); for (k = fore->w_width - 1; k >= 0 && p[k] == ' '; k--) ; @@ -782,7 +782,10 @@ processchar: rep_cnt = 0; if (rep_cnt > 100) rep_cnt = 100; - revto_line(markdata->left_mar, (rep_cnt * (fore->w_histheight + fore->w_height)) / 100, (fore->w_height - 1) / 2); + revto_line(markdata->left_mar, + fore->w_histheight - fore->w_scrollback_height + + (int)(rep_cnt * (fore->w_scrollback_height + fore->w_height) / 100.0), + (fore->w_height - 1) / 2); break; case 0201: case 'g': @@ -1122,8 +1125,8 @@ int tx, ty, line; tx = 0; else if (tx > fore->w_width - 1) tx = fore->w_width -1; - if (ty < 0) - ty = 0; + if (ty < fore->w_histheight - fore->w_scrollback_height) + ty = fore->w_histheight - fore->w_scrollback_height; else if (ty > fore->w_histheight + fore->w_height - 1) ty = fore->w_histheight + fore->w_height - 1; diff --git a/src/resize.c b/src/resize.c index ba7988d..9790012 100644 --- a/src/resize.c +++ b/src/resize.c @@ -1019,6 +1019,8 @@ int wi, he, hi; /* store new size */ p->w_width = wi; p->w_height = he; + if(p->w_scrollback_height > hi) + p->w_scrollback_height = hi; #ifdef COPY_PASTE p->w_histidx = 0; p->w_histheight = hi; diff --git a/src/window.h b/src/window.h index fa82609..bd10dcd 100644 --- a/src/window.h +++ b/src/window.h @@ -248,6 +248,7 @@ struct win int w_slowpaste; /* do careful writes to the window */ int w_histheight; /* all histbases are malloced with width * histheight */ int w_histidx; /* 0 <= histidx < histheight; where we insert lines */ + int w_scrollback_height; /* number of lines of output stored, to be updated with w_histidx, w_histheight */ struct mline *w_hlines; /* history buffer */ struct paster w_paster; /* paste info */ #else |