From c30a6232df03e1efbd9f3b226777b07e087a1122 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 12 Oct 2020 14:27:29 +0200 Subject: BASELINE: Update Chromium to 85.0.4183.140 Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen --- chromium/tools/json_schema_compiler/code.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'chromium/tools/json_schema_compiler/code.py') diff --git a/chromium/tools/json_schema_compiler/code.py b/chromium/tools/json_schema_compiler/code.py index ef41cf88407..c23fc483c50 100644 --- a/chromium/tools/json_schema_compiler/code.py +++ b/chromium/tools/json_schema_compiler/code.py @@ -124,13 +124,18 @@ class Code(object): def trim_comment(comment, max_len): if len(comment) <= max_len: return comment, '' + # If we ran out of space due to existing content, don't try to wrap. + if max_len <= 1: + return '', comment.lstrip() last_space = comment.rfind(' ', 0, max_len + 1) if last_space != -1: line = comment[0:last_space] comment = comment[last_space + 1:] else: - line = comment[0:max_len] - comment = comment[max_len:] + # If the line can't be split, then don't try. The comments might be + # important (e.g. JSDoc) where splitting it breaks things. + line = comment + comment = '' return line, comment.lstrip() # First line has the full maximum length. @@ -145,6 +150,7 @@ class Code(object): # Any subsequent lines be subject to the wrap indent. max_len = (self._comment_length - len(''.join(self._line_prefixes)) - len(comment_prefix) - wrap_indent) + assert max_len > 1 while len(comment): line, comment = trim_comment(comment, max_len) self.Append(comment_prefix + (' ' * wrap_indent) + line, substitute=False) -- cgit v1.2.1