Skip to content

Commit

Permalink
Handle empty buffer when shifting left/right
Browse files Browse the repository at this point in the history
Closes #930
  • Loading branch information
wasamasa authored and TheBB committed Dec 3, 2019
1 parent 926da83 commit 6b2758f
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 6b2758f

Please sign in to comment.