DBTS> Recently I've begun to use mytop. Everything is very comfortable except DBTS> the fact that the terminal flickers when repainting. I've written the DBTS> patch removing this effect.
DBTS> Unfortunately I can't test it on many platforms so I've realised it as DBTS> an additional option --vt100. last version for this patch (attache) no artefacts )
--- old/mytop-1.6/mytop 2008-04-23 11:37:57.000000000 +0400
+++ new/mytop-1.6/mytop 2008-04-23 11:37:34.000000000 +0400
@@ -73,6 +73,7 @@
## Default Config Values
my %config = (
+ vt100 => 0,
batchmode => 0,
color => 1,
db => '',
@@ -104,6 +105,15 @@
my $CLEAR = $WIN ? '': `clear`;
+my %vt100_commands=
+(
+ CURSOR_TO_START => "\x1b[0;0f",
+ CURSOR_SAVE => "\x1b[s",
+ CURSOR_RESTORE => "\x1b[u",
+ EEL => "\x1b[K", # Erase end of line
+ EEB => "\x1b[J", # Erase down
+);
+
## Term::ReadKey values
my $RM_RESET = 0;
@@ -140,6 +150,7 @@
Getopt::Long::Configure('no_ignore_case', 'bundling');
GetOptions(
+ "vt100" => \$config{vt100},
"color!" => \$config{color},
"user|u=s" => \$config{user},
"pass|password|p=s" => \$config{pass},
@@ -158,6 +169,9 @@
"sort=s" => \$config{sort},
);
+($config{batchmode} or not -t STDOUT)
+ and $config{vt100}=0;
+
## User may have put the port with the host.
if ($config{host} =~ s/:(\d+)$//)
@@ -171,6 +185,7 @@
{
require Term::ReadKey;
Term::ReadKey->import();
+ Clear();
}
## User may want to disable color.
@@ -682,6 +697,13 @@
}
}
+sub CursorToStartNotClear()
+{
+ $config{vt100} or return Clear;
+ $WIN and return Clear;
+ print $vt100_commands{CURSOR_TO_START};
+}
+
my $last_time;
sub GetData()
@@ -693,6 +715,8 @@
my ($width, $height, $wpx, $hpx, $lines_left);
+ local $\=$config{vt100}?"$vt100_commands{EEL}":'';
+
if (not $config{batchmode})
{
($width, $height, $wpx, $hpx) = GetTerminalSize();
@@ -810,7 +834,7 @@
my $host_width = 52;
my $up_width = $width - $host_width;
- Clear() unless $config{batchmode};
+ CursorToStartNotClear() unless $config{batchmode};
print RESET();
printf "%-${host_width}s%${up_width}s\n",
@@ -896,7 +920,7 @@
if (not $config{batchmode} and not $config{header})
{
- Clear();
+ CursorToStartNotClear();
print RESET();
}
@@ -1059,6 +1082,8 @@
}
+ $config{vt100} and
+ print "$vt100_commands{EEL}$vt100_commands{EEB}";
}
###########################################################################
@@ -1709,6 +1734,11 @@
Use if you'd like B<mytop> to connect to a specific database by
default. Default: none.
+=item B<--vt100>
+
+For screen re-drawing use esc-sequence vt100. It is remove terminal
+twinkling.
+
=item B<-b> or B<--batch> or B<--batchmode>
In batch mode, mytop runs only once, does not clear the screen, and
signature.asc
Description: Digital signature

