Faster line-number-at-pos calculation

This commit is contained in:
Renato Ferreira
2019-05-02 21:41:14 -03:00
parent 5ffb19af48
commit b39e9631d6
4 changed files with 21 additions and 8 deletions

View File

@@ -75,9 +75,9 @@ an exceedingly quick way of adding multiple cursors to multiple lines."
(rrm/remove-rectangular-region-overlays)
(let* ((annoying-arrows-mode nil)
(point-column (current-column))
(point-line (line-number-at-pos))
(point-line (mc/line-number-at-pos))
(anchor-column (save-excursion (goto-char rrm/anchor) (current-column)))
(anchor-line (save-excursion (goto-char rrm/anchor) (line-number-at-pos)))
(anchor-line (save-excursion (goto-char rrm/anchor) (mc/line-number-at-pos)))
(left-column (if (< point-column anchor-column) point-column anchor-column))
(right-column (if (> point-column anchor-column) point-column anchor-column))
(navigation-step (if (< point-line anchor-line) 1 -1)))
@@ -85,7 +85,7 @@ an exceedingly quick way of adding multiple cursors to multiple lines."
(set-mark (point))
(move-to-column point-column)
(mc/save-excursion
(while (not (= anchor-line (line-number-at-pos)))
(while (not (= anchor-line (mc/line-number-at-pos)))
(forward-line navigation-step)
(move-to-column anchor-column)
(when (= anchor-column (current-column))