--- /dev/null
+From 5b7472b9b70a16201bcaa4cb69c617c19b889b77 Mon Sep 17 00:00:00 2001
+From: Dennis Groenen <tj.groenen@gmail.com>
+Date: Fri, 22 Jun 2012 21:49:21 +0200
+Subject: [PATCH] backport: vi: save/restore screen upon invocation
+
+Backport of git commit d3dff879f0683c2a4119f694c1b20c96ee030a26
+---
+ editors/vi.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/editors/vi.c b/editors/vi.c
+index b4ad12e..8aea2e2 100644
+--- a/editors/vi.c
++++ b/editors/vi.c
+@@ -603,11 +603,15 @@ int vi_main(int argc, char **argv)
+ optind = 0;
+
+ //----- This is the main file handling loop --------------
++ // "Save cursor, use alternate screen buffer, clear screen"
++ write1("\033[?1049h");
+ while (1) {
+ edit_file(argv[optind]); /* param might be NULL */
+ if (++optind >= argc)
+ break;
+ }
++ // "Use normal screen buffer, restore cursor"
++ write1("\033[?1049l");
+ //-----------------------------------------------------------
+
+ return 0;
+--
+1.7.11
+