Bug #142508 - Clear the screen each time before calling
authorZac Medico <zmedico@gentoo.org>
Fri, 5 Oct 2007 01:59:15 +0000 (01:59 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 5 Oct 2007 01:59:15 +0000 (01:59 -0000)
the "diff" command so that any remnants of the previous
config are now shown with the current one. (trunk r7893)

svn path=/main/branches/2.1.2/; revision=7926

bin/dispatch-conf

index 55bf13cfd5a3623700d7a1101046331864f7d63c..94e2d6cac4f4ebbecbe21ef00bf53df936629c98 100755 (executable)
@@ -215,6 +215,7 @@ class dispatch:
             show_new_diff = 0
 
             while 1:
+                clear_screen()
                 if show_new_diff:
                     os.system((self.options['diff']) % (conf['new'], mrgconf))
                     show_new_diff = 0
@@ -377,6 +378,19 @@ def getch ():
         termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
     return ch
 
+def clear_screen():
+    try:
+        import curses
+        try:
+            curses.setupterm()
+            sys.stdout.write(curses.tigetstr("clear"))
+            sys.stdout.flush()
+            return
+        except curses.error:
+            pass
+    except ImportError:
+        pass
+    os.system("clear 2>/dev/null")
 
 # run
 d = dispatch ()