[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 21b9edf 021/167: Fix up visual-line-mode limitation logic
From: |
Oleh Krehel |
Subject: |
[elpa] master 21b9edf 021/167: Fix up visual-line-mode limitation logic |
Date: |
Tue, 08 Dec 2015 10:49:39 +0000 |
branch: master
commit 21b9edf64a3e2c0bde14e3dc31b2dd1669904009
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Fix up visual-line-mode limitation logic
* swiper.el (swiper-use-visual-line): New defvar.
(swiper--candidates):
(swiper--update-input-ivy):
(swiper--action): Update.
Re #227
---
swiper.el | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/swiper.el b/swiper.el
index 0f8ff31..bd7dc18 100644
--- a/swiper.el
+++ b/swiper.el
@@ -215,16 +215,22 @@
(defvar swiper--width nil
"Store the amount of digits needed for the longest line nubmer.")
+(defvar swiper-use-visual-line nil
+ "When non-nil, use `line-move' instead of `forward-line'.")
+
(defun swiper--candidates ()
"Return a list of this buffer lines."
+ (setq swiper-use-visual-line
+ (and (not (eq major-mode 'org-mode))
+ visual-line-mode
+ (< (buffer-size) 20000)))
(let ((n-lines (count-lines (point-min) (point-max))))
(unless (zerop n-lines)
(setq swiper--width (1+ (floor (log n-lines 10))))
(setq swiper--format-spec
(format "%%-%dd " swiper--width))
(let ((line-number 0)
- (advancer (if (and visual-line-mode
- (< (buffer-size) 20000))
+ (advancer (if swiper-use-visual-line
(lambda (arg) (line-move arg t))
#'forward-line))
candidates)
@@ -234,7 +240,7 @@
(while (< (point) (point-max))
(let ((str (concat " " (buffer-substring
(point)
- (if visual-line-mode
+ (if swiper-use-visual-line
(save-excursion
(end-of-visual-line)
(point))
@@ -354,7 +360,7 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
(goto-char (point-min))
(when (cl-plusp num)
(goto-char (point-min))
- (if visual-line-mode
+ (if swiper-use-visual-line
(line-move (1- num))
(forward-line (1- num)))
(if (and (equal ivy-text "")
@@ -423,7 +429,7 @@ BEG and END, when specified, are the point bounds."
(if (null x)
(user-error "No candidates")
(goto-char (point-min))
- (funcall (if visual-line-mode
+ (funcall (if swiper-use-visual-line
#'line-move
#'forward-line)
(1- (read (get-text-property 0 'display x))))
- [elpa] master fa49a81 018/167: Fix "End of buffer" for swiper and visual-line-mode, (continued)
- [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, 2015/12/08
- [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 <=
- [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
- [elpa] master e722d6a 046/167: swiper.el (swiper-mc): Add and bind to "C-7", Oleh Krehel, 2015/12/08
- [elpa] master 3a3b052 036/167: swiper.el: Add a lot of avy declares, Oleh Krehel, 2015/12/08
- [elpa] master 3699fa9 041/167: Don't reset the match to first if the current one still works, Oleh Krehel, 2015/12/08
- [elpa] master 877648a 045/167: ivy.el (ivy-case-fold-search): New defvar, Oleh Krehel, 2015/12/08