summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/termpty.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 21f6a53..71d47a6 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -768,23 +768,7 @@ termpty_resize(Termpty *ty, int new_w, int new_h)
768 new_back = calloc(sizeof(Termsave *), ty->backmax); 768 new_back = calloc(sizeof(Termsave *), ty->backmax);
769 769
770 y_end = ty->state.cy; 770 y_end = ty->state.cy;
771 y_start = termpty_line_find_top(ty, y_end); 771 new_y_end = new_h - 1;
772 if (ty->w == 1)
773 {
774 new_y_start = new_h - 1;
775 new_y_end = new_y_start - 1;
776 }
777 else
778 {
779 new_y_start = new_h - 1 - (y_end - y_start);
780 new_y_end = new_y_start - 1;
781 if (new_y_end < 0)
782 {
783 new_y_start = 0;
784 new_y_end = -1;
785 }
786 }
787 y_end = y_start - 1;
788 while ((y_end >= -ty->backscroll_num) && (new_y_end >= -ty->backmax)) 772 while ((y_end >= -ty->backscroll_num) && (new_y_end >= -ty->backmax))
789 { 773 {
790 y_start = termpty_line_find_top(ty, y_end); 774 y_start = termpty_line_find_top(ty, y_end);
@@ -802,6 +786,8 @@ termpty_resize(Termpty *ty, int new_w, int new_h)
802 ty->w = new_w; 786 ty->w = new_w;
803 ty->h = new_h; 787 ty->h = new_h;
804 ty->state.cy = MIN((new_h - 1) - new_y_start, new_h - 1); 788 ty->state.cy = MIN((new_h - 1) - new_y_start, new_h - 1);
789 ty->state.cx = termpty_line_length(new_screen + ((new_h - 1) * new_w),
790 new_w);
805 ty->circular_offset = MAX(new_y_start, 0); 791 ty->circular_offset = MAX(new_y_start, 0);
806 ty->backpos = 0; 792 ty->backpos = 0;
807 ty->backscroll_num = MAX(-new_y_start, 0); 793 ty->backscroll_num = MAX(-new_y_start, 0);