Scrollbar was failing to update when no scrollback-reset event had happened
[u/mdw/putty] / terminal.c
index 6a6deb0..cf55f8e 100644 (file)
@@ -82,7 +82,7 @@ typedef struct {
 #define poslt(p1,p2) ( (p1).y < (p2).y || ( (p1).y == (p2).y && (p1).x < (p2).x ) )
 #define posle(p1,p2) ( (p1).y < (p2).y || ( (p1).y == (p2).y && (p1).x <= (p2).x ) )
 #define poseq(p1,p2) ( (p1).y == (p2).y && (p1).x == (p2).x )
-#define posdiff(p1,p2) ( ((p2).y - (p1).y) * (cols+1) + (p2).x - (p1).x )
+#define posdiff(p1,p2) ( ((p1).y - (p2).y) * (cols+1) + (p1).x - (p2).x )
 #define incpos(p) ( (p).x == cols ? ((p).x = 0, (p).y++, 1) : ((p).x++, 0) )
 #define decpos(p) ( (p).x == 0 ? ((p).x = cols, (p).y--, 1) : ((p).x--, 0) )
 
@@ -298,11 +298,12 @@ void term_update(void)
     Context ctx;
     ctx = get_ctx();
     if (ctx) {
+       if (seen_disp_event)
+           update_sbar();
        if ((seen_key_event && (cfg.scroll_on_key)) ||
            (seen_disp_event && (cfg.scroll_on_disp))) {
            disptop = 0;               /* return to main screen */
            seen_disp_event = seen_key_event = 0;
-           update_sbar();
        }
        do_paint(ctx, TRUE);
        sys_cursor(curs.x, curs.y - disptop);
@@ -1142,11 +1143,9 @@ void term_out(void)
                    /*
                     * Perform an actual beep if we're not overloaded.
                     */
-                   if ((!cfg.bellovl || !beep_overloaded)
-                       && cfg.beep != 0) {
-                       if (cfg.beep != 2)
-                           beep(cfg.beep);
-                       else if (cfg.beep == 2) {
+                   if (!cfg.bellovl || !beep_overloaded) {
+                       beep(cfg.beep);
+                       if (cfg.beep == BELL_VISUAL) {
                            in_vbell = TRUE;
                            vbell_timeout = ticks + VBELL_TIMEOUT;
                            term_update();