Skip to content

Commit

Permalink
Merge pull request #931 from emacs-evil/evil-shift-empty-buffer
Browse files Browse the repository at this point in the history
Handle empty buffer when shifting left/right
  • Loading branch information
TheBB authored Dec 3, 2019
2 parents 926da83 + 6b2758f commit 81032e0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions evil-commands.el
Original file line number Diff line number Diff line change
Expand Up @@ -1812,6 +1812,12 @@ See also `evil-shift-left'."
(indent-to new-indent 0))
(delete-region (point) (progn (skip-chars-forward " \t") (point)))
(forward-line 1))))
;; in case we're in an empty buffer first-shift is still unchanged
(unless first-shift
(if (< count 0)
(setq first-shift 0)
(setq first-shift (* count evil-shift-width))
(indent-to first-shift)))
;; assuming that point is in the first line, adjust its position
(if (called-interactively-p 'any)
(evil-first-non-blank)
Expand Down

0 comments on commit 81032e0

Please sign in to comment.