Merges from Irssi CVS.
[crypto.git] / apps / irssi / src / fe-text / term-terminfo.c
index 4e9781fe744f405efd4c786d97a74029086d7a91..ddb00441d0b81204d5f22cc2391bc7072cea9cae 100644 (file)
@@ -77,7 +77,8 @@ static int redraw_timeout(void)
 
 int term_init(void)
 {
-        struct sigaction act;
+       struct sigaction act;
+        int width, height;
 
        last_fg = last_bg = -1;
        last_attrs = 0;
@@ -89,6 +90,11 @@ int term_init(void)
        if (current_term == NULL)
                return FALSE;
 
+       if (term_get_size(&width, &height)) {
+                current_term->width = width;
+                current_term->height = height;
+       }
+
         /* grab CONT signal */
        sigemptyset(&act.sa_mask);
        act.sa_flags = 0;
@@ -113,6 +119,7 @@ int term_init(void)
 void term_deinit(void)
 {
        if (current_term != NULL) {
+               signal(SIGCONT, SIG_DFL);
                g_source_remove(redraw_tag);
 
                term_common_deinit();
@@ -369,7 +376,7 @@ static void term_printed_text(int count)
        vcx += count;
        while (vcx >= term_width) {
                vcx -= term_width;
-               if (vcy < term_height) vcy++;
+               if (vcy < term_height-1) vcy++;
                if (vcx > 0) term_lines_empty[vcy] = FALSE;
        }
 }