d74b327
diff --git a/ansi.c b/ansi.c
d74b327
index e76eef4..bbdc119 100644
d74b327
--- a/ansi.c
d74b327
+++ b/ansi.c
d74b327
@@ -1444,8 +1444,8 @@ int c, intermediate;
d443bf9
 		  else
d443bf9
 		    {
d74b327
 		      if (curr->w_alt.on) {
d74b327
-		        LeaveAltScreen(curr);
d74b327
 		        RestoreCursor(&curr->w_alt.cursor);
d74b327
+		        LeaveAltScreen(curr);
d74b327
 		      }
d443bf9
 		    }
d443bf9
 		  if (a1 == 47 && !i)