[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master cbaa811 014/167: Use forward-line instead of line-move if
From: |
Oleh Krehel |
Subject: |
[elpa] master cbaa811 014/167: Use forward-line instead of line-move if possible |
Date: |
Tue, 08 Dec 2015 10:49:36 +0000 |
branch: master
commit cbaa81195ec5cc0b4b06dcf29a12bd73bf0ad0ff
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Use forward-line instead of line-move if possible
* swiper.el (swiper--candidates):
(swiper--update-input-ivy):
(swiper--action): `line-move' is much slower than `forward-line'. Use it
only if `visual-line-mode' is on.
---
swiper.el | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/swiper.el b/swiper.el
index cfc80cd..9e70265 100644
--- a/swiper.el
+++ b/swiper.el
@@ -195,6 +195,9 @@
(setq swiper--format-spec
(format "%%-%dd " swiper--width))
(let ((line-number 0)
+ (advancer (if visual-line-mode
+ #'line-move
+ #'forward-line))
candidates)
(save-excursion
(goto-char (point-min))
@@ -212,7 +215,7 @@
(cl-incf line-number))
str)
(push str candidates))
- (line-move 1))
+ (funcall advancer 1))
(nreverse candidates))))))
(defvar swiper--opoint 1
@@ -322,7 +325,9 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
(goto-char (point-min))
(when (cl-plusp num)
(goto-char (point-min))
- (line-move (1- num))
+ (if visual-line-mode
+ (line-move (1- num))
+ (forward-line (1- num)))
(if (and (equal ivy-text "")
(>= swiper--opoint (line-beginning-position))
(<= swiper--opoint (line-end-position)))
@@ -389,7 +394,10 @@ BEG and END, when specified, are the point bounds."
(if (null x)
(user-error "No candidates")
(goto-char (point-min))
- (line-move (1- (read (get-text-property 0 'display x))))
+ (funcall (if visual-line-mode
+ #'line-move
+ #'forward-line)
+ (1- (read (get-text-property 0 'display x))))
(re-search-forward
(ivy--regex input) (line-end-position) t)
(swiper--ensure-visible)
- [elpa] master 6bf3239 006/167: ivy.el (ivy-yank-word): Add only one space each time, (continued)
- [elpa] master 6bf3239 006/167: ivy.el (ivy-yank-word): Add only one space each time, Oleh Krehel, 2015/12/08
- [elpa] master 73e5799 012/167: Fix counsel-git-grep not updating to 0 candidates, Oleh Krehel, 2015/12/08
- [elpa] master dfb41d0 016/167: Implement ivy-avy, Oleh Krehel, 2015/12/08
- [elpa] master eda091b 017/167: Customize ivy-avy and fix compile warnings, Oleh Krehel, 2015/12/08
- [elpa] master fa49a81 018/167: Fix "End of buffer" for swiper and visual-line-mode, Oleh Krehel, 2015/12/08
- [elpa] master 1714220 022/167: swiper.el (swiper-font-lock-ensure): Exclude help-mode, Oleh Krehel, 2015/12/08
- [elpa] master 6db3d54 024/167: ivy.el (ivy--insert-prompt): Use newlines instead of truncation, Oleh Krehel, 2015/12/08
- [elpa] master 1c1e6fc 008/167: ivy.el (ivy--reset-state): Less strict on :preselect, Oleh Krehel, 2015/12/08
- [elpa] master c89c167 007/167: Specify shell command for counsel-git-grep with prefix arg, Oleh Krehel, 2015/12/08
- [elpa] master ff077c6 013/167: counsel.el (counsel--gg-candidates): Use counsel-git-grep-cmd, Oleh Krehel, 2015/12/08
- [elpa] master cbaa811 014/167: Use forward-line instead of line-move if possible,
Oleh Krehel <=
- [elpa] master 4e0c3f1 019/167: swiper-avy: show avy hints in minibuffer as well, Oleh Krehel, 2015/12/08
- [elpa] master 52c9565 020/167: swiper.el (swiper--candidates): Avoid line-move for large buffers, Oleh Krehel, 2015/12/08
- [elpa] master 47a220d 023/167: Support hash tables in ivy-read, Oleh Krehel, 2015/12/08
- [elpa] master 21b9edf 021/167: Fix up visual-line-mode limitation logic, Oleh Krehel, 2015/12/08
- [elpa] master 126158d 025/167: ivy.el (ivy--filter): Anchor only for swiper, Oleh Krehel, 2015/12/08
- [elpa] master 800e640 028/167: Fix "M-o k" when switching buffers, Oleh Krehel, 2015/12/08
- [elpa] master b9d0502 026/167: ivy.el (ivy--filter): Fix typo, Oleh Krehel, 2015/12/08
- [elpa] master 6956311 027/167: Adjust ivy-state-preselect for file name completion, Oleh Krehel, 2015/12/08
- [elpa] master 6f4d46b 034/167: Fix preselect for input "^", Oleh Krehel, 2015/12/08
- [elpa] master ef189f1 030/167: ivy.el (ivy-count-format): Extend customize choices, Oleh Krehel, 2015/12/08