[systemd-commits] src/util.c

Lennart Poettering lennart at kemper.freedesktop.org
Wed Jun 29 12:17:38 PDT 2011


 src/util.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 8585357a0e5e9f4d56e999d7cd1a73e77ae0eb80
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jun 29 21:17:31 2011 +0200

    util: clear scrolling region when clearing screen

diff --git a/src/util.c b/src/util.c
index 278f018..a0c04e3 100644
--- a/src/util.c
+++ b/src/util.c
@@ -4674,7 +4674,11 @@ int vt_disallocate(const char *name) {
                 if (fd < 0)
                         return fd;
 
-                loop_write(fd, "\033[H\033[2J", 7, false); /* clear screen */
+                loop_write(fd,
+                           "\033[r"    /* clear scrolling region */
+                           "\033[H"    /* move home */
+                           "\033[2J",  /* clear screen */
+                           10, false);
                 close_nointr_nofail(fd);
 
                 return 0;
@@ -4710,8 +4714,11 @@ int vt_disallocate(const char *name) {
         if (fd < 0)
                 return fd;
 
-        /* Requires Linux 2.6.40 */
-        loop_write(fd, "\033[H\033[3J", 7, false); /* clear screen including scrollback */
+        loop_write(fd,
+                   "\033[r"   /* clear scrolling region */
+                   "\033[H"   /* move home */
+                   "\033[3J", /* clear screen including scrollback, requires Linux 2.6.40 */
+                   10, false);
         close_nointr_nofail(fd);
 
         return 0;



More information about the systemd-commits mailing list