aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Forsman <axelsfor@gmail.com>2022-11-29 11:48:15 +0100
committerTom Dalziel <33435574+tomdl89@users.noreply.github.com>2022-12-29 17:38:43 +0000
commite2ec733b056c27f0d6c819e6bf6adbbdc0ef8316 (patch)
tree6f21f847b2228433a015fbc9023985d980c594cb
parentbe6b09bcecf3bfdbaadecb21f31c57ce18abac05 (diff)
Remove str-conversions in evil-visual-block-corner
-rw-r--r--evil-states.el44
-rw-r--r--evil-types.el6
2 files changed, 16 insertions, 34 deletions
diff --git a/evil-states.el b/evil-states.el
index a7242c2..2bdf015 100644
--- a/evil-states.el
+++ b/evil-states.el
@@ -281,7 +281,7 @@ the selection is enabled.
;; refresh the :corner property
(setq evil-visual-properties
(plist-put evil-visual-properties :corner
- (evil-visual-block-corner 'upper-left))))
+ (evil-visual-block-corner))))
(evil-define-state visual
"Visual state."
@@ -812,37 +812,21 @@ the horizontal or vertical component of CORNER is used.
CORNER defaults to `upper-left'."
(let* ((point (or point (point)))
(mark (or mark (mark t)))
- (corner (symbol-name
- (or corner
- (and (overlayp evil-visual-overlay)
- (overlay-get evil-visual-overlay
- :corner))
- 'upper-left)))
+ (corner (or corner
+ (when (overlayp evil-visual-overlay)
+ (overlay-get evil-visual-overlay :corner))
+ 'upper-left))
(point-col (evil-column point))
(mark-col (evil-column mark))
- horizontal vertical)
- (cond
- ((= point-col mark-col)
- (setq horizontal
- (or (and (string-match "left\\|right" corner)
- (match-string 0 corner))
- "left")))
- ((< point-col mark-col)
- (setq horizontal "left"))
- ((> point-col mark-col)
- (setq horizontal "right")))
- (cond
- ((= (line-number-at-pos point)
- (line-number-at-pos mark))
- (setq vertical
- (or (and (string-match "upper\\|lower" corner)
- (match-string 0 corner))
- "upper")))
- ((< point mark)
- (setq vertical "upper"))
- ((> point mark)
- (setq vertical "lower")))
- (intern (format "%s-%s" vertical horizontal))))
+ (upperp (if (= (line-number-at-pos point) (line-number-at-pos mark))
+ (memq corner '(upper-left upper-right))
+ (< point mark)))
+ (leftp (if (= point-col mark-col)
+ (memq corner '(upper-left lower-left))
+ (< point-col mark-col))))
+ (if upperp
+ (if leftp 'upper-left 'upper-right)
+ (if leftp 'lower-left 'lower-right))))
;;; Operator-Pending state
diff --git a/evil-types.el b/evil-types.el
index d457158..645d2cf 100644
--- a/evil-types.el
+++ b/evil-types.el
@@ -104,10 +104,8 @@ and will be removed in a future version."
:contract (lambda (beg end)
(evil-range beg (max beg (1- end))))
:normalize (lambda (beg end)
- (goto-char end)
- (when (eq (char-after) ?\n)
- (setq end (max beg (1- end))))
- (evil-range beg end))
+ (evil-range beg (if (eq (char-after end) ?\n)
+ (max beg (1- end)) end)))
:string (lambda (beg end)
(let ((width (- end beg)))
(format "%s character%s" width