~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/text.py

  • Committer: Vincent Ladeuil
  • Date: 2009-12-16 10:54:55 UTC
  • mfrom: (4747.5.3 316357-SIGWINCH)
  • mto: This revision was merged to the branch mainline in revision 4902.
  • Revision ID: v.ladeuil+lp@free.fr-20091216105455-c1knt5e61o177gg2
Catch SIGWINCH on Unices

Show diffs side-by-side

added added

removed removed

Lines of Context:
248
248
        self._term_file = term_file
249
249
        # true when there's output on the screen we may need to clear
250
250
        self._have_output = False
251
 
        # XXX: We could listen for SIGWINCH and update the terminal width...
252
 
        # https://launchpad.net/bugs/316357
253
 
        self._width = osutils.terminal_width()
254
251
        self._last_transport_msg = ''
255
252
        self._spin_pos = 0
256
253
        # time we last repainted the screen
267
264
 
268
265
    def _show_line(self, s):
269
266
        # sys.stderr.write("progress %r\n" % s)
270
 
        if self._width is not None:
271
 
            n = self._width - 1
272
 
            s = '%-*.*s' % (n, n, s)
 
267
        width = osutils.terminal_width()
 
268
        if width is not None:
 
269
            # we need one extra space for terminals that wrap on last char
 
270
            width = width - 1
 
271
            s = '%-*.*s' % (width, width, s)
273
272
        self._term_file.write('\r' + s + '\r')
274
273
 
275
274
    def clear(self):