@@ -2655,20 +2655,19 @@ corner and point in the lower left."
26552655 (evil-visual-refresh))))
26562656
26572657(evil-define-command evil-visual-rotate (corner &optional beg end type)
2658- "In Visual Block selection, put point in CORNER .
2659- Corner may be one of `upper-left', `upper-right', `lower-left'
2660- and `lower-right':
2658+ "Move point to CORNER of the Visual selection .
2659+ Corner may be one of `upper-left', `upper-right', `lower-left' and
2660+ `lower-right':
26612661
2662- upper-left +---+ upper-right
2663- | |
2664- lower-left +---+ lower-right
2662+ upper-left +---+ upper-right
2663+ | |
2664+ lower-left +---+ lower-right
26652665
2666- When called interactively, the selection is rotated blockwise ."
2666+ When called interactively, the selection is rotated clockwise ."
26672667 :keep-visual t
26682668 (interactive
2669- (let ((corners '(upper-left upper-right lower-right lower-left)))
2670- (list (or (cadr (memq (evil-visual-block-corner) corners))
2671- 'upper-left))))
2669+ (let ((corners '#1=(upper-left upper-right lower-right lower-left . #1#)))
2670+ (list (cadr (memq (evil-visual-block-corner) corners)))))
26722671 (let* ((beg (or beg (point)))
26732672 (end (or end (mark t) beg))
26742673 (type (or type evil-this-type))
@@ -2697,43 +2696,21 @@ When called interactively, the selection is rotated blockwise."
26972696
26982697(defun evil-insert (count &optional vcount skip-empty-lines)
26992698 "Switch to Insert state just before point.
2700- The insertion will be repeated COUNT times and repeated once for
2701- the next VCOUNT - 1 lines starting at the same column.
2699+ The insertion will be repeated COUNT times on the next VCOUNT lines,
2700+ starting at the same column.
27022701If SKIP-EMPTY-LINES is non-nil, the insertion will not be performed
27032702on lines on which the insertion point would be after the end of the
27042703lines. This is the default behaviour for Visual-state insertion."
27052704 (interactive
2706- (let ((lines+ 0))
2705+ (if (not (evil-visual-state-p))
2706+ (list (prefix-numeric-value current-prefix-arg))
2707+ (evil-visual-rotate 'upper-left)
27072708 (list (prefix-numeric-value current-prefix-arg)
2708- (and (evil-visual-state-p)
2709- (memq (evil-visual-type) '(line block))
2710- (save-excursion
2711- (let ((m (mark)))
2712- (evil-visual-rotate 'lower-right)
2713- ;; count-lines misses an empty final line, so correct that
2714- (and (bolp) (eolp) (setq lines+ 1))
2715- ;; go to upper-left corner temporarily so
2716- ;; `count-lines' yields accurate results
2717- (evil-visual-rotate 'upper-left)
2718- (prog1 (+ (count-lines evil-visual-beginning evil-visual-end)
2719- lines+)
2720- (set-mark m)))))
2721- (evil-visual-state-p))))
2722- (if (and (called-interactively-p 'any)
2723- (evil-visual-state-p))
2724- (cond
2725- ((eq (evil-visual-type) 'line)
2726- (evil-visual-rotate 'upper-left)
2727- (evil-insert-line count vcount))
2728- ((eq (evil-visual-type) 'block)
2729- (let ((column (min (evil-column evil-visual-beginning)
2730- (evil-column evil-visual-end))))
2731- (evil-visual-rotate 'upper-left)
2732- (move-to-column column t)
2733- (evil-insert count vcount skip-empty-lines)))
2734- (t
2735- (evil-visual-rotate 'upper-left)
2736- (evil-insert count vcount skip-empty-lines)))
2709+ (when (memq (evil-visual-type) '(line block))
2710+ (1+ (evil-count-lines evil-visual-point evil-visual-mark)))
2711+ t)))
2712+ (if (and (evil-visual-state-p) (eq (evil-visual-type) 'line))
2713+ (evil-insert-line count vcount)
27372714 (setq evil-insert-count count
27382715 evil-insert-lines nil
27392716 evil-insert-vcount (and vcount
@@ -2755,13 +2732,7 @@ the lines."
27552732 (list (prefix-numeric-value current-prefix-arg)
27562733 (and (evil-visual-state-p)
27572734 (memq (evil-visual-type) '(line block))
2758- (save-excursion
2759- (let ((m (mark)))
2760- ;; go to upper-left corner temporarily so
2761- ;; `count-lines' yields accurate results
2762- (evil-visual-rotate 'upper-left)
2763- (prog1 (count-lines evil-visual-beginning evil-visual-end)
2764- (set-mark m)))))))
2735+ (1+ (evil-count-lines evil-visual-point evil-visual-mark)))))
27652736 (if (and (called-interactively-p 'any)
27662737 (evil-visual-state-p))
27672738 (cond
0 commit comments