~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-10 12:31:39 UTC
  • mto: (4901.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4902.
  • Revision ID: v.ladeuil+lp@free.fr-20091210123139-n8mgml3nid1the59
Cleanup and NEWS entry.

* bzrlib/ui/text.py:
(TextProgressView._show_line): Stop caching terminal width.

Show diffs side-by-side

added added

removed removed

Lines of Context:
218
218
        self._term_file = term_file
219
219
        # true when there's output on the screen we may need to clear
220
220
        self._have_output = False
221
 
        # XXX: We could listen for SIGWINCH and update the terminal width...
222
 
        # https://launchpad.net/bugs/316357
223
 
        self._width = osutils.terminal_width()
224
221
        self._last_transport_msg = ''
225
222
        self._spin_pos = 0
226
223
        # time we last repainted the screen
234
231
 
235
232
    def _show_line(self, s):
236
233
        # sys.stderr.write("progress %r\n" % s)
237
 
        self._width = osutils.terminal_width()
238
 
        if self._width is not None:
239
 
            n = self._width - 1
240
 
            s = '%-*.*s' % (n, n, s)
 
234
        width = osutils.terminal_width()
 
235
        if width is not None:
 
236
            # we need one extra space for terminals that wrap on last char
 
237
            width = width - 1
 
238
            s = '%-*.*s' % (width, width, s)
241
239
        self._term_file.write('\r' + s + '\r')
242
240
 
243
241
    def clear(self):