diff options
author | Alexander Kornienko <alexfh@google.com> | 2016-10-27 13:46:49 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2016-10-27 13:46:49 +0000 |
commit | 21cdcf60376c486dd0eb92ccea5e809e27f25a8f (patch) | |
tree | a1a873a976ad733fed094fe7081993559821e519 /tools/clang-format | |
parent | 39bf9749a5f06fd161878212c9718b6bf7190165 (diff) |
Fix warnings from python difflib.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285291 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/clang-format')
-rw-r--r-- | tools/clang-format/clang-format.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/clang-format/clang-format.py b/tools/clang-format/clang-format.py index 6a5740679b..5a5f99b259 100644 --- a/tools/clang-format/clang-format.py +++ b/tools/clang-format/clang-format.py @@ -51,8 +51,8 @@ if vim.eval('exists("g:clang_format_fallback_style")') == "1": def main(): # Get the current text. encoding = vim.eval("&encoding") - buf = vim.current.buffer - text = unicode('\n'.join(buf), encoding) + buf = [ unicode(line, encoding) for line in vim.current.buffer ] + text = '\n'.join(buf) # Determine range to format. if vim.eval('exists("l:lines")') == '1': @@ -99,7 +99,7 @@ def main(): lines = stdout.decode(encoding).split('\n') output = json.loads(lines[0]) lines = lines[1:] - sequence = difflib.SequenceMatcher(None, vim.current.buffer, lines) + sequence = difflib.SequenceMatcher(None, buf, lines) for op in reversed(sequence.get_opcodes()): if op[0] is not 'equal': vim.current.buffer[op[1]:op[2]] = lines[op[3]:op[4]] |