]> granicus.if.org Git - clang/commitdiff
Fix off-by-one error in clang-format's emacs integration.
authorDaniel Jasper <djasper@google.com>
Tue, 21 May 2013 17:05:40 +0000 (17:05 +0000)
committerDaniel Jasper <djasper@google.com>
Tue, 21 May 2013 17:05:40 +0000 (17:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182395 91177308-0d34-0410-b5e6-96231b3b80d8

tools/clang-format/clang-format.el

index af69118aa2d5c0a630b392ec08181cccabdfc3dd..48fe36f2e5635a7c758b682e8d18502c8f54656c 100644 (file)
         (call-process-region (point-min) (point-max) clang-format-binary t t nil
                              "-offset" (number-to-string (1- begin))
                              "-length" (number-to-string (- end begin))
-                             "-cursor" (number-to-string (point))
+                             "-cursor" (number-to-string (1- (point)))
                              "-style" style)
       (goto-char (point-min))
       (let ((json-output (json-read-from-string
                            (buffer-substring-no-properties
                              (point-min) (line-beginning-position 2)))))
         (delete-region (point-min) (line-beginning-position 2))
-        (goto-char (cdr (assoc 'Cursor json-output)))
+        (goto-char (1+ (cdr (assoc 'Cursor json-output))))
         (dotimes (index (length orig-windows))
           (set-window-start (nth index orig-windows)
                             (nth index orig-window-starts)))))))