Experimental change in the behaviour of `disable alternate terminal
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 27 May 2003 09:43:14 +0000 (09:43 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 27 May 2003 09:43:14 +0000 (09:43 +0000)
screen'. Now it also disables the save-and-restore-cursor behaviour
of ESC[?1048h and ESC[?1049h, since these sequences seem to be
output by software trying to switch to the alternate screen, and it
looks very odd to have the cursor position restored to where it was
before `less' when the garbage `less' wrote all over the screen is
still around. The `traditional' ESC 7 and ESC 8 still function as
normal, on the basis that they aren't usually used in conjunction
with the alternate screen. I'm not sure whether this will be the
right decision; I'm prepared to change it back if a sufficiently
serious counterexample shows up.

git-svn-id: svn://svn.tartarus.org/sgt/putty@3222 cda61777-01e9-0310-a592-d414129be87e

terminal.c

index 5f6cdb1..05a6233 100644 (file)
@@ -1263,17 +1263,18 @@ static void toggle_mode(Terminal *term, int mode, int query, int state)
            term->disptop = 0;
            break;
          case 1048:                   /* save/restore cursor */
-           save_cursor(term, state);
+           if (!term->cfg.no_alt_screen)
+                save_cursor(term, state);
            if (!state) term->seen_disp_event = TRUE;
            break;
          case 1049:                   /* cursor & alternate screen */
-           if (state)
+           if (state && !term->cfg.no_alt_screen)
                save_cursor(term, state);
            if (!state) term->seen_disp_event = TRUE;
            compatibility(OTHER);
            deselect(term);
            swap_screen(term, term->cfg.no_alt_screen ? 0 : state, TRUE, FALSE);
-           if (!state)
+           if (!state && !term->cfg.no_alt_screen)
                save_cursor(term, state);
            term->disptop = 0;
            break;