title: python VTE Terminal weirdness
body: <p>i'm trying to use the terminal from python <a href="http://library.gnome.org/devel/vte/" rel="nofollow noreferrer">VTE</a> binding (python-vte from debian squeeze) as a virtual terminal emulator (just for ANSI/control chars text processing)</p>
  
  <p>in interactive python console, everything looks (almost) all right:</p>
  
  <pre><code>&gt;&gt;&gt; import vte
  &gt;&gt;&gt; term = vte.Terminal()
  &gt;&gt;&gt; term.feed("a\nb")
  &gt;&gt;&gt; print repr(term.get_text(lambda *a: True).rstrip())
  'a\n b'
  </code></pre>
  
  <p>however, launching this code (little modified) as python script, different result is yielded:</p>
  
  <pre><code>$ python vte_wiredness_1.py 
  ''
  </code></pre>
  
  <p>strangely enough, pasting the code back into the (new) interactive python session also yields empty string:</p>
  
  <pre><code>&gt;&gt;&gt; import vte
  &gt;&gt;&gt; term = vte.Terminal()
  &gt;&gt;&gt; term.feed("a\nb")
  &gt;&gt;&gt; print repr(term.get_text(lambda *a: True).rstrip())
  ''
  &gt;&gt;&gt;
  </code></pre>
  
  <p>first thing caming on my mind was that the only difference between the two cases is the timing - there had to be some delay before <code>get_text</code>. unfortunately, preluding <code>get_text</code> with some seconds sleep did not help</p>
  
  <p>then i thought it has something to do with X window environment. but the results are the same pure linux console (with some warning on missing graphics).</p>
  
  <p>i wonder what causes such an unpredictable behavior (interactive console - pasted vs typed, and it's not the delay.. ant the interactive console has nothing to do with the vte terminal object.. i guess)</p>
  
  <p>can someone explain what is happening? is it possible to use the VTE Term such way?</p>
  
  <p>that the "b" letter in the output is preceded by the space, is another strangeness (all consecutive lines are preceded by more spaces.. looks like I have to send carriage return before the string.)</p>
  
  <p>(the <code>lambda *a: True</code> <a href="http://library.gnome.org/devel/libvtemm/unstable/classGnome_1_1Vte_1_1Terminal.html#a5ea58027108d5c27d51882a8b1392e44" rel="nofollow noreferrer">get_text</a> method argument i'm using is a dummy callback, it's is some <a href="http://library.gnome.org/devel/libsigc++/unstable/classsigc_1_1slot.html" rel="nofollow noreferrer">SlotSelectedCallback</a>.. for its explanation i'd be grateful as well :) )</p>