Fix the text wrapping to not remove starting white space

This commit is contained in:
Kevin Cathcart 2018-04-18 21:14:52 -04:00
parent 33e076209e
commit 5257e7d827
1 changed files with 3 additions and 5 deletions

View File

@ -501,8 +501,6 @@ class MultiByteCoreTextMapper(object):
word = words.pop(0) word = words.pop(0)
# sanity check: if the word we have is more than 14 characters, we take as much as we can still fit and push the rest back for later # sanity check: if the word we have is more than 14 characters, we take as much as we can still fit and push the rest back for later
if cls.wordlen(word) > wrap: if cls.wordlen(word) > wrap:
if linespace < wrap:
word = ' ' + word
(word_first, word_rest) = cls.splitword(word, linespace) (word_first, word_rest) = cls.splitword(word, linespace)
words.insert(0, word_rest) words.insert(0, word_rest)
lines.insert(0, ' '.join(words)) lines.insert(0, ' '.join(words))
@ -510,9 +508,9 @@ class MultiByteCoreTextMapper(object):
outbuf.extend(RawMBTextMapper.convert(word_first)) outbuf.extend(RawMBTextMapper.convert(word_first))
break break
if cls.wordlen(word) <= (linespace if linespace == wrap else linespace - 1): if cls.wordlen(word) <= linespace:
if linespace < wrap: if cls.wordlen(word) < linespace:
word = ' ' + word word = word + ' '
linespace -= cls.wordlen(word) linespace -= cls.wordlen(word)
outbuf.extend(RawMBTextMapper.convert(word)) outbuf.extend(RawMBTextMapper.convert(word))
else: else: