mirror of
https://github.com/jimeh/rubocopfmt.el.git
synced 2026-02-19 09:06:41 +00:00
fix: Always move back to same column after applying rcs patch
Previously the cursor would move to the beginning of line if the current line was changed by `rubocopfmt`. This fix is borrowed from: https://github.com/dominikh/go-mode.el/pull/236
This commit is contained in:
@@ -113,7 +113,8 @@ to format buffer before saving, instead of `rubocopfmt'."
|
||||
;; Appending lines decrements the offset (possibly making it
|
||||
;; negative), deleting lines increments it. This order
|
||||
;; simplifies the forward-line invocations.
|
||||
(line-offset 0))
|
||||
(line-offset 0)
|
||||
(column (current-column)))
|
||||
(save-excursion
|
||||
(with-current-buffer patch-buffer
|
||||
(goto-char (point-min))
|
||||
@@ -140,7 +141,8 @@ to format buffer before saving, instead of `rubocopfmt'."
|
||||
(cl-incf line-offset len)
|
||||
(rubocopfmt--delete-whole-line len)))
|
||||
(t
|
||||
(error "Invalid rcs patch or internal error in rubocopfmt--apply-rcs-patch")))))))))
|
||||
(error "Invalid rcs patch or internal error in rubocopfmt--apply-rcs-patch")))))))
|
||||
(move-to-column column)))
|
||||
|
||||
(defun rubocopfmt--delete-whole-line (&optional arg)
|
||||
"Delete the current line without putting it in the `kill-ring'.
|
||||
|
||||
Reference in New Issue
Block a user