diff --git a/src/vte-private.h b/src/vte-private.h
index 83fd67e..d9c34e4 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -168,6 +168,10 @@ typedef struct _VtePaletteColor {
 	} sources[2];
 } VtePaletteColor;
 
+typedef struct _VteScrollingRegion {
+	int start, end;
+} VteScrollingRegion;
+
 /* Terminal private data. */
 struct _VteTerminalPrivate {
         /* Metric and sizing data: dimensions of the window */
@@ -219,20 +223,33 @@ struct _VteTerminalPrivate {
 	 * screen, which seems to be a DEC-specific feature. */
 	struct _VteScreen {
 		VteRing row_data[1];	/* buffer contents */
-		VteVisualPosition cursor_saved;  /* relative to the insertion delta */
 		long scroll_delta;	/* scroll offset */
 		long insert_delta;	/* insertion offset */
+
+		/* Stuff saved along with the cursor */
+		VteVisualPosition cursor_saved;
+		gboolean saved_reverse_mode;
+		gboolean saved_origin_mode;
+		gboolean saved_sendrecv_mode;
+		gboolean saved_insert_mode;
+		gboolean saved_linefeed_mode;
+		VteScrollingRegion saved_scrolling_region;
+		gboolean saved_scrolling_restricted;
+		VteCell saved_defaults;
+		VteCell saved_color_defaults;
+		VteCell saved_fill_defaults;
+		VteCharacterReplacement saved_character_replacements[2];
+		VteCharacterReplacement *saved_character_replacement;
 	} normal_screen, alternate_screen, *screen;
 
+	/* Values we save along with the cursor */
 	VteVisualPosition cursor_current;  /* relative to the insertion delta */
 	gboolean reverse_mode;	/* reverse mode */
 	gboolean origin_mode;	/* origin mode */
 	gboolean sendrecv_mode;	/* sendrecv mode */
 	gboolean insert_mode;	/* insert mode */
 	gboolean linefeed_mode;	/* linefeed mode */
-	struct vte_scrolling_region {
-		int start, end;
-	} scrolling_region;	/* the region we scroll in */
+	VteScrollingRegion scrolling_region;	/* the region we scroll in */
 	gboolean scrolling_restricted;
 	VteCell defaults;	/* default characteristics
 				   for insertion of any new
@@ -244,6 +261,8 @@ struct _VteTerminalPrivate {
 				   plus the current
 				   fore/back with no
 				   character data */
+        VteCharacterReplacement character_replacements[2];
+        VteCharacterReplacement *character_replacement;  /* pointer to the active item in the character_replacements array */
 
 	/* Selection information. */
 	gboolean has_selection;
@@ -278,8 +297,6 @@ struct _VteTerminalPrivate {
 	gboolean text_deleted_flag;
 	gboolean rewrap_on_resize;
 	gboolean bracketed_paste_mode;
-        VteCharacterReplacement character_replacements[2];
-        VteCharacterReplacement *character_replacement;  /* pointer to the active item in the character_replacements array */
 
 	/* Scrolling options. */
 	gboolean scroll_background;
diff --git a/src/vteseq.c b/src/vteseq.c
index 92050a1..f5464f7 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -386,6 +386,72 @@ _vte_terminal_scroll_text (VteTerminal *terminal, int scroll_amount)
 	terminal->pvt->text_deleted_flag = TRUE;
 }
 
+/* Restore cursor. */
+static void
+vte_sequence_handler_restore_cursor (VteTerminal *terminal, GValueArray *params)
+{
+	VteScreen *screen;
+	screen = terminal->pvt->screen;
+
+	terminal->pvt->cursor_current.col = screen->cursor_saved.col;
+	terminal->pvt->cursor_current.row = CLAMP(screen->cursor_saved.row,
+						  0, terminal->pvt->row_count - 1);
+
+	terminal->pvt->reverse_mode = screen->saved_reverse_mode;
+	terminal->pvt->origin_mode = screen->saved_origin_mode;
+	terminal->pvt->sendrecv_mode = screen->saved_sendrecv_mode;
+	terminal->pvt->insert_mode = screen->saved_insert_mode;
+	terminal->pvt->linefeed_mode = screen->saved_linefeed_mode;
+	terminal->pvt->scrolling_region = screen->saved_scrolling_region;
+	terminal->pvt->scrolling_restricted = screen->saved_scrolling_restricted;
+	terminal->pvt->defaults = screen->saved_defaults;
+	terminal->pvt->color_defaults = screen->saved_color_defaults;
+	terminal->pvt->fill_defaults = screen->saved_fill_defaults;
+	terminal->pvt->character_replacements[0] = screen->saved_character_replacements[0];
+	terminal->pvt->character_replacements[1] = screen->saved_character_replacements[1];
+	terminal->pvt->character_replacement = screen->saved_character_replacement;
+}
+
+/* Save cursor. */
+static void
+vte_sequence_handler_save_cursor (VteTerminal *terminal, GValueArray *params)
+{
+	VteScreen *screen;
+	screen = terminal->pvt->screen;
+
+	screen->cursor_saved = terminal->pvt->cursor_current;
+
+	screen->saved_reverse_mode = terminal->pvt->reverse_mode;
+	screen->saved_origin_mode = terminal->pvt->origin_mode;
+	screen->saved_sendrecv_mode = terminal->pvt->sendrecv_mode;
+	screen->saved_insert_mode = terminal->pvt->insert_mode;
+	screen->saved_linefeed_mode = terminal->pvt->linefeed_mode;
+	screen->saved_scrolling_region = terminal->pvt->scrolling_region;
+	screen->saved_scrolling_restricted = terminal->pvt->scrolling_restricted;
+	screen->saved_defaults = terminal->pvt->defaults;
+	screen->saved_color_defaults = terminal->pvt->color_defaults;
+	screen->saved_fill_defaults = terminal->pvt->fill_defaults;
+	screen->saved_character_replacements[0] = terminal->pvt->character_replacements[0];
+	screen->saved_character_replacements[1] = terminal->pvt->character_replacements[1];
+	screen->saved_character_replacement = terminal->pvt->character_replacement;
+}
+
+/* Switch to normal screen and restore cursor (in this order). */
+static void
+vte_sequence_handler_normal_screen_and_restore_cursor (VteTerminal *terminal, GValueArray *params)
+{
+	terminal->pvt->screen = &terminal->pvt->normal_screen;
+	vte_sequence_handler_restore_cursor (terminal, params);
+}
+
+/* Save cursor and switch to alternate screen (in this order). */
+static void
+vte_sequence_handler_save_cursor_and_alternate_screen (VteTerminal *terminal, GValueArray *params)
+{
+	vte_sequence_handler_save_cursor (terminal, params);
+	terminal->pvt->screen = &terminal->pvt->alternate_screen;
+}
+
 /* Set icon/window titles. */
 static void
 vte_sequence_handler_set_title_internal(VteTerminal *terminal,
@@ -691,11 +757,11 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
                  vte_sequence_handler_save_cursor,},
 		/* 1049: Use alternate screen buffer, saving the cursor
 		 * position. */
-		{1049, 0, 0, PRIV_OFFSET(screen),
-		 PRIV_OFFSET(normal_screen),
-		 PRIV_OFFSET(alternate_screen),
-                 vte_sequence_handler_restore_cursor,
-                 vte_sequence_handler_save_cursor,},
+		{1049, 0, 0, 0,
+		 0,
+		 0,
+                 vte_sequence_handler_normal_screen_and_restore_cursor,
+                 vte_sequence_handler_save_cursor_and_alternate_screen,},
 		/* 2004: Bracketed paste mode. */
 		{2004, PRIV_OFFSET(bracketed_paste_mode), 0, 0,
 		 FALSE,
@@ -823,12 +889,9 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
 	case 47:
 	case 1047:
 	case 1049:
-		/* Clear the alternate screen if we're switching
-		 * to it, and home the cursor. */
+		/* Clear the alternate screen if we're switching to it */
 		if (set) {
-			_vte_terminal_set_default_attributes (terminal);
 			_vte_terminal_clear_screen (terminal);
-			_vte_terminal_home_cursor (terminal);
 		}
 		/* Reset scrollbars and repaint everything. */
 		gtk_adjustment_set_value(terminal->pvt->vadjustment,
@@ -1464,28 +1527,6 @@ vte_sequence_handler_linux_console_cursor_attributes (VteTerminal *terminal, GVa
 {
 }
 
-/* Restore cursor (position). */
-static void
-vte_sequence_handler_restore_cursor (VteTerminal *terminal, GValueArray *params)
-{
-	VteScreen *screen;
-	screen = terminal->pvt->screen;
-	terminal->pvt->cursor_current.col = screen->cursor_saved.col;
-	terminal->pvt->cursor_current.row = CLAMP(screen->cursor_saved.row,
-					   0, terminal->pvt->row_count - 1);
-}
-
-/* Save cursor (position). */
-static void
-vte_sequence_handler_save_cursor (VteTerminal *terminal, GValueArray *params)
-{
-	VteScreen *screen;
-	screen = terminal->pvt->screen;
-	screen->cursor_saved.col = terminal->pvt->cursor_current.col;
-	screen->cursor_saved.row = CLAMP(terminal->pvt->cursor_current.row,
-					 0, terminal->pvt->row_count - 1);
-}
-
 /* Scroll the text down N lines, but don't move the cursor. */
 static void
 vte_sequence_handler_scroll_down (VteTerminal *terminal, GValueArray *params)
