aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Dalziel <tom_dl@hotmail.com>2022-01-06 18:16:44 +0100
committerTom Dalziel <33435574+tomdl89@users.noreply.github.com>2022-01-07 13:18:49 +0100
commit94fda4cc6416b326426bdf650a15dcd32d197f70 (patch)
treead1a948b67131d42b752da436d8e3b24218af054
parentc2bb7e3fa22a6fe38559046904ec1ecc7502b4b0 (diff)
Simplify evil-visual-restore
-rw-r--r--evil-commands.el17
1 files changed, 2 insertions, 15 deletions
diff --git a/evil-commands.el b/evil-commands.el
index f75f685..4611666 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -2402,27 +2402,14 @@ when called interactively."
"Restore previous selection."
(let* ((point (point))
(mark (or (mark t) point))
- (dir evil-visual-direction)
- (type (evil-visual-type))
- range)
+ (type (evil-visual-type)))
+ ;; TODO handle swapping selection in visual state...
(unless (evil-visual-state-p)
(cond
;; No previous selection.
((or (null evil-visual-selection)
(null evil-visual-mark)
(null evil-visual-point)))
- ;; If the type was one-to-one, it is preferable to infer
- ;; point and mark from the selection's boundaries. The reason
- ;; is that a destructive operation may displace the markers
- ;; inside the selection.
- ((evil-type-property type :one-to-one)
- (setq range (evil-contract-range (evil-visual-range))
- mark (evil-range-beginning range)
- point (evil-range-end range))
- (when (< dir 0)
- (evil-swap mark point)))
- ;; If the type wasn't one-to-one, we have to restore the
- ;; selection on the basis of the previous point and mark.
(t
(setq mark evil-visual-mark
point evil-visual-point)))