Skip to content

Commit ae53774

Browse files
Serhiy's suggestions
1 parent 8d5f84f commit ae53774

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Tools/i18n/pygettext.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,8 @@ def normalize(s, encoding, prefix, options):
223223
lines = []
224224
for line in s.splitlines(True):
225225
escaped_line = escape(line, encoding)
226-
if len(escaped_line) + len(prefix) + 2 > options.width and _space_splitter.search(line): # don't wrap single words
226+
if len(escaped_line) + len(prefix) + 3 > options.width:
227227
words = _space_splitter.findall(line)
228-
words = [w for w in words if w]
229228
words.reverse()
230229
buf = []
231230
size = 0
@@ -234,10 +233,7 @@ def normalize(s, encoding, prefix, options):
234233
escaped_word = escape(word, encoding)
235234
escaped_word_len = len(escaped_word)
236235
new_size = size + escaped_word_len
237-
if new_size + 2 <= options.width:
238-
buf.append(escaped_word)
239-
size = new_size
240-
elif not buf:
236+
if new_size + 2 <= options.width or not buf:
241237
buf.append(escaped_word)
242238
size = new_size
243239
else:

0 commit comments

Comments
 (0)