Author: djasper
Date: Mon Jul 22 11:22:13 2013
New Revision: 186840

URL: http://llvm.org/viewvc/llvm-project?rev=186840&view=rev
Log:
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.

Modified:
    cfe/trunk/tools/clang-format/clang-format.py

Modified: cfe/trunk/tools/clang-format/clang-format.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/clang-format.py?rev=186840&r1=186839&r2=186840&view=diff
==============================================================================
--- cfe/trunk/tools/clang-format/clang-format.py (original)
+++ cfe/trunk/tools/clang-format/clang-format.py Mon Jul 22 11:22:13 2013
@@ -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))


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to