Index: chrome/test/chromedriver/cpp_source.py |
diff --git a/chrome/test/chromedriver/cpp_source.py b/chrome/test/chromedriver/cpp_source.py |
index 498fd2549ab88cac0ca19f8c96ce8dfe76e98093..be8697da841d028e3fa28f53ee73ae9641f4dff7 100644 |
--- a/chrome/test/chromedriver/cpp_source.py |
+++ b/chrome/test/chromedriver/cpp_source.py |
@@ -7,6 +7,9 @@ |
import datetime |
import os |
+# 80-character max line length, minus 4 spaces, and 2 quotations. |
+MAX_LINE_LEN = 74 |
+ |
def WriteSource(base_name, |
dir_from_src, |
@@ -57,7 +60,17 @@ def WriteSource(base_name, |
for name, contents in global_string_map.iteritems(): |
lines = [] |
if '\n' not in contents: |
- lines = [' "%s"' % EscapeLine(contents)] |
+ |
+ contents = EscapeLine(contents) |
+ while len(contents) > MAX_LINE_LEN: |
+ if contents[MAX_LINE_LEN-1] == '\\': |
+ lines.append(' "%s"' % contents[:MAX_LINE_LEN-1]) |
+ contents = contents[MAX_LINE_LEN-1:] |
+ else: |
+ lines.append(' "%s"' % contents[:MAX_LINE_LEN]) |
+ contents = contents[MAX_LINE_LEN:] |
+ |
+ lines.append(' "%s"' % contents) |
samuong
2014/12/11 00:22:19
Maybe an easier way to do this is to just pump eve
srawlins
2014/12/12 23:41:29
Done.
|
else: |
for line in contents.split('\n'): |
lines += [' "%s\\n"' % EscapeLine(line)] |