comparison mercurial/util.py @ 32527:47ce079b1afa

util: look for empty-sysstr instead of empty-bytesstr in textwrap code Fixes behavior on Python 3.
author Augie Fackler <raf@durin42.com>
date Sun, 28 May 2017 16:17:43 -0400
parents bb18728ea617
children 3b8155305fbe
comparison
equal deleted inserted replaced
32526:9d08283946f0 32527:47ce079b1afa
2308 # Maximum width for this line. 2308 # Maximum width for this line.
2309 width = self.width - len(indent) 2309 width = self.width - len(indent)
2310 2310
2311 # First chunk on line is whitespace -- drop it, unless this 2311 # First chunk on line is whitespace -- drop it, unless this
2312 # is the very beginning of the text (i.e. no lines started yet). 2312 # is the very beginning of the text (i.e. no lines started yet).
2313 if self.drop_whitespace and chunks[-1].strip() == '' and lines: 2313 if self.drop_whitespace and chunks[-1].strip() == r'' and lines:
2314 del chunks[-1] 2314 del chunks[-1]
2315 2315
2316 while chunks: 2316 while chunks:
2317 l = colwidth(chunks[-1]) 2317 l = colwidth(chunks[-1])
2318 2318
2330 if chunks and colwidth(chunks[-1]) > width: 2330 if chunks and colwidth(chunks[-1]) > width:
2331 self._handle_long_word(chunks, cur_line, cur_len, width) 2331 self._handle_long_word(chunks, cur_line, cur_len, width)
2332 2332
2333 # If the last chunk on this line is all whitespace, drop it. 2333 # If the last chunk on this line is all whitespace, drop it.
2334 if (self.drop_whitespace and 2334 if (self.drop_whitespace and
2335 cur_line and cur_line[-1].strip() == ''): 2335 cur_line and cur_line[-1].strip() == r''):
2336 del cur_line[-1] 2336 del cur_line[-1]
2337 2337
2338 # Convert current line back to a string and store it in list 2338 # Convert current line back to a string and store it in list
2339 # of all lines (return value). 2339 # of all lines (return value).
2340 if cur_line: 2340 if cur_line: