Skip to content

Commit

Permalink
Re-add return-type evil-operator-range argument
Browse files Browse the repository at this point in the history
It was removed by commit 29a5d46,
however this broke the evil-surround package.
  • Loading branch information
axelf4 committed Jan 15, 2023
1 parent 29a5d46 commit 49fc382
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
21 changes: 13 additions & 8 deletions evil-macros.el
Original file line number Diff line number Diff line change
Expand Up @@ -563,24 +563,26 @@ Optional keyword arguments are:
(setq evil-inhibit-operator-value nil)))))

;; this is used in the `interactive' specification of an operator command
(defun evil-operator-range ()
"Read a motion from the keyboard and return its buffer positions."
(let* ((evil-ex-p (and (not (minibufferp)) (evil-ex-p)))
(defun evil-operator-range (&optional return-type)
"Read a motion from the keyboard and return its buffer positions.
The return value is a list (BEG END), or (BEG END TYPE) if
RETURN-TYPE is non-nil."
(let* ((ex-p (and (not (minibufferp)) (evil-ex-p)))
(motion (or evil-operator-range-motion
(when evil-ex-p 'evil-line)))
(when ex-p 'evil-line)))
(type evil-operator-range-type)
range count)
(setq evil-this-type-modified nil)
(evil-save-echo-area
(cond
;; Ex mode
((and evil-ex-p evil-ex-range)
((and ex-p evil-ex-range)
(setq range evil-ex-range))
;; Visual selection
((and (not evil-ex-p) (evil-visual-state-p))
((and (not ex-p) (evil-visual-state-p))
(setq range (evil-visual-range)))
;; active region
((and (not evil-ex-p) (region-active-p))
((and (not ex-p) (region-active-p))
(setq range (evil-range (region-beginning)
(region-end)
(or evil-this-type 'exclusive))))
Expand Down Expand Up @@ -636,7 +638,10 @@ Optional keyword arguments are:
(setq evil-operator-range-beginning (evil-range-beginning range)
evil-operator-range-end (evil-range-end range)
evil-operator-range-type (evil-type range))
range))
(if return-type
(list (car range) (cadr range) (evil-type range))
(setcdr (cdr range) nil)
range)))

(defmacro evil-define-type (type doc &rest body)
"Define type TYPE.
Expand Down
7 changes: 2 additions & 5 deletions evil-types.el
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,11 @@ directly."

(evil-define-interactive-code "<r>"
"Untyped motion range (BEG END)."
(let ((range (evil-operator-range)))
(setcdr (cdr range) nil)
range))
(evil-operator-range))

(evil-define-interactive-code "<R>"
"Typed motion range (BEG END TYPE)."
(let ((range (evil-operator-range)))
(list (car range) (cadr range) (evil-type range))))
(evil-operator-range t))

(evil-define-interactive-code "<v>"
"Typed motion range of visual range(BEG END TYPE).
Expand Down

0 comments on commit 49fc382

Please # to comment.