Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 97e9628

Browse files
committedNov 27, 2015
Disable long word wrapping entirely in comments.
As pointed out by nico, we should unconditionally disable breaking of long words in comments. It is unlikely long words that are in comments should be split (like pathnames).
1 parent 8c18cf9 commit 97e9628

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed
 

‎misc/ninja_syntax.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ def newline(self):
2222
self.output.write('\n')
2323

2424
def comment(self, text, has_path=False):
25-
args = {}
26-
if has_path:
27-
args['break_long_words'] = args['break_on_hyphens'] = False
28-
for line in textwrap.wrap(text, self.width - 2, **args):
25+
for line in textwrap.wrap(text, self.width - 2, break_long_words=False,
26+
break_on_hyphens=False):
2927
self.output.write('# ' + line + '\n')
3028

3129
def variable(self, key, value, indent=0):

‎misc/ninja_syntax_test.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,8 @@ def test_few_long_words(self):
4646
self.out.getvalue())
4747

4848
def test_comment_wrap(self):
49-
# We should wrap the comments
50-
self.n.comment('Hello there')
51-
self.assertEqual('# Hello\n# there\n', self.out.getvalue())
52-
53-
def test_comment_wrap_filename(self):
5449
# Filenames shoud not be wrapped
55-
self.n.comment('Hello /usr/local/build-tools/bin', has_path=True)
50+
self.n.comment('Hello /usr/local/build-tools/bin')
5651
self.assertEqual('# Hello\n# /usr/local/build-tools/bin\n',
5752
self.out.getvalue())
5853

0 commit comments

Comments
 (0)