Commit 7c61dcb3 authored by Asanka Herath's avatar Asanka Herath Committed by Commit Bot

[git-cl] Preserve line breaks when pretty printing CL description.

Also set the line wrap limit to 72 + indent from 70 columns total. The
latter was limiting the CL description to 68 columns total before
wrapping kicked in.

BUG=none

Change-Id: I93c984c7b121d4bb042d0dc81a662352f77df4d1
Reviewed-on: https://chromium-review.googlesource.com/420243Reviewed-by: 's avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
parent 1bc7bfe5
......@@ -1421,9 +1421,11 @@ class Changelist(object):
self.description = self._codereview_impl.FetchDescription()
self.has_description = True
if pretty:
wrapper = textwrap.TextWrapper()
# Set width to 72 columns + 2 space indent.
wrapper = textwrap.TextWrapper(width=74, replace_whitespace=True)
wrapper.initial_indent = wrapper.subsequent_indent = ' '
return wrapper.fill(self.description)
lines = self.description.splitlines()
return '\n'.join([wrapper.fill(line) for line in lines])
return self.description
def GetPatchset(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment