[Rt-devel] PATCH: use Term::ReadLine only when needed

David Schweikert dws at ee.ethz.ch
Wed Apr 26 09:14:09 EDT 2006


Hi,

The following patch for the rt-command avoids initializing the terminal
with Term::ReadLine unless it is needed (rt shell).

Without this patch, you can notice the cursor moving around whenever you
execute an rt command (like rt list or rt edit) and if you resize the
window, you get very unpleasing errors.

Cheers
David

--- bin/rt.in~  2006-03-21 03:18:44.000000000 +0100
+++ bin/rt.in   2006-04-26 14:48:02.742296000 +0200
@@ -82,9 +82,7 @@
 my $session = new Session("$HOME/.rt_sessions");
 my $REST = "$config{server}/REST/1.0";
 
-my $term = new Term::ReadLine 'RT CLI';
 my $prompt = 'rt> ';
-my $TERM_OUT = $term->OUT || \*STDOUT;
 
 sub whine;
 sub DEBUG { warn @_ if $config{debug} >= shift }
@@ -149,6 +147,7 @@
 
 sub shell {
     $|=1;
+    my $term = new Term::ReadLine 'RT CLI';
     while ( defined ($_ = $term->readline($prompt)) ) {
         next if /^#/ || /^\s*$/;


-- 
David Schweikert        | phone: +41 44 632 7019
System manager ISG.EE   | walk:  ETH Zentrum, ETL F24.1
ETH Zurich, Switzerland | web:   http://people.ee.ethz.ch/dws


More information about the Rt-devel mailing list