diff options
| author | Daniel Jasper <djasper@google.com> | 2013-07-22 16:22:13 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2013-07-22 16:22:13 +0000 |
| commit | 8e2c20a77da33924cb7e4967a2f56c4ed1cf45cf (patch) | |
| tree | df265181ac667bbce57c93ee510bead1a1cf767b /clang/tools/clang-format/clang-format.py | |
| parent | 31d6fd84e671d41e4e042da5eb04886e3d801fb8 (diff) | |
| download | bcm5719-llvm-8e2c20a77da33924cb7e4967a2f56c4ed1cf45cf.tar.gz bcm5719-llvm-8e2c20a77da33924cb7e4967a2f56c4ed1cf45cf.zip | |
Fix bug in clang-format's vim integration cause by r186789.
After the first operation, the buffer contents has changed and thus all
other operations would be invalid. Executing the operations in reversed
order should fix this.
llvm-svn: 186840
Diffstat (limited to 'clang/tools/clang-format/clang-format.py')
| -rw-r--r-- | clang/tools/clang-format/clang-format.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/tools/clang-format/clang-format.py b/clang/tools/clang-format/clang-format.py index bf84ed0f5cf..1d27985ea08 100644 --- a/clang/tools/clang-format/clang-format.py +++ b/clang/tools/clang-format/clang-format.py @@ -69,7 +69,7 @@ else: output = json.loads(lines[0]) lines = lines[1:] sequence = difflib.SequenceMatcher(None, vim.current.buffer, lines) - for op in sequence.get_opcodes(): + 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]] vim.command('goto %d' % (output['Cursor'] + 1)) |

