Introduce a sane interface function, from_backend(), for backends to
[u/mdw/putty] / terminal.c
index 8a1d68d..4cd003a 100644 (file)
@@ -215,6 +215,7 @@ void term_update(void) {
             (seen_disp_event && (!cfg.scroll_on_key)) ) {
            disptop = scrtop;
            seen_disp_event = seen_key_event = 0;
+           update_sbar();
        }
        do_paint (ctx, TRUE);
         sys_cursor(curs_x, curs_y + (scrtop - disptop) / (cols+1));
@@ -1253,7 +1254,7 @@ static int beep_overload = 0;
                    /* VTTEST Bug 9 - if region is less than 2 lines
                     * don't change region.
                     */
-                   if (bot-top > 1) {
+                   if (bot-top > 0) {
                        marg_t = top;
                        marg_b = bot;
                        curs_x = 0;
@@ -2055,24 +2056,27 @@ void term_mouse (Mouse_Button b, Mouse_Action a, int x, int y) {
                }
                while (q < nlpos && q < selend)
                {
+#if 0
                    /* VT Specials -> ISO8859-1  */
                    static const char poorman2[] =
  "* # HTFFCRLF\xB0 \xB1 NLVT+ + + + + - - - - - + + + + | <=>=PI!=\xA3 \xB7 ";
+#endif
 
                    int ch = (*q & CHAR_MASK);
 
-                   if ((*q & ATTR_LINEDRW) && ch >= 0x60 && ch <  0x7F )
-                   {
+#if 0
+                   if ((*q & ATTR_LINEDRW) && ch >= 0x60 && ch < 0x7F) {
                        int x;
                        *p++ = poorman2[2*(ch-0x60)];
                        if ( (x = poorman2[2*(ch-0x60)+1]) != ' ')
                            *p++ = x;
-                   }
+                   } else
+#endif
 #if 0
-                   else if ((*q & ATTR_GBCHR) && ch == '#')
+                   if ((*q & ATTR_GBCHR) && ch == '#')
                        *p++ = (unsigned char) 0xA3;
-#endif
                    else
+#endif
                        *p++ = (unsigned char) ch;
                    q++;
                }
@@ -2184,3 +2188,14 @@ void term_deselect (void) {
     deselect();
     term_update();
 }
+
+/*
+ * from_backend(), to get data from the backend for the terminal.
+ */
+void from_backend(int is_stderr, char *data, int len) {
+    while (len--) {
+       if (inbuf_head >= INBUF_SIZE)
+           term_out();
+       inbuf[inbuf_head++] = *data++;
+    }
+}