[git commit] vi: save/restore screen upon invocation

Denys Vlasenko vda.linux at googlemail.com
Mon Jun 11 11:53:26 UTC 2012


commit: http://git.busybox.net/busybox/commit/?id=d3dff879f0683c2a4119f694c1b20c96ee030a26
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
vi_main                                              253     273     +20

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 editors/vi.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/editors/vi.c b/editors/vi.c
index 459f374..e09e0d9 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -598,11 +598,15 @@ int vi_main(int argc, char **argv)
 	//----- This is the main file handling loop --------------
 	save_argc = argc;
 	optind = 0;
+	// "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;


More information about the busybox-cvs mailing list