ui/doom-modeline: fix off-by-one in selection-info segment

This commit is contained in:
Henrik Lissner 2018-04-25 05:17:56 -04:00
parent ac570f3f18
commit 4d2d3953b8
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -473,7 +473,7 @@ lines are selected, or the NxM dimensions of a block selection."
(cons evil-visual-beginning evil-visual-end) (cons evil-visual-beginning evil-visual-end)
(cons (region-beginning) (region-end))) (cons (region-beginning) (region-end)))
(propertize (propertize
(let ((lines (count-lines beg (min (1+ end) (point-max))))) (let ((lines (count-lines beg (min end (point-max)))))
(concat (cond ((or (bound-and-true-p rectangle-mark-mode) (concat (cond ((or (bound-and-true-p rectangle-mark-mode)
(eq 'block evil-visual-selection)) (eq 'block evil-visual-selection))
(let ((cols (abs (- (doom-column end) (let ((cols (abs (- (doom-column end)
@ -482,9 +482,9 @@ lines are selected, or the NxM dimensions of a block selection."
((eq 'line evil-visual-selection) ((eq 'line evil-visual-selection)
(format "%dL" lines)) (format "%dL" lines))
((> lines 1) ((> lines 1)
(format "%dC %dL" (- (1+ end) beg) lines)) (format "%dC %dL" (- end beg) lines))
(t (t
(format "%dC" (- (1+ end) beg)))) (format "%dC" (- end beg))))
(when +doom-modeline-enable-word-count (when +doom-modeline-enable-word-count
(format " %dW" (count-words beg end))))) (format " %dW" (count-words beg end)))))
'face 'doom-modeline-highlight)))) 'face 'doom-modeline-highlight))))