[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 82a317c 011/167: Make swiper compatible with visual-line-m
From: |
Oleh Krehel |
Subject: |
[elpa] master 82a317c 011/167: Make swiper compatible with visual-line-mode |
Date: |
Tue, 08 Dec 2015 10:49:35 +0000 |
branch: master
commit 82a317ce813d7364774dcf44bd432f363e878bea
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Make swiper compatible with visual-line-mode
* swiper.el (swiper--candidates): Use `end-of-visual-line' and
`line-move' appropriately.
(swiper--update-input-ivy):
(swiper--action): Use `line-move' instead of `forward-line'.
(swiper--add-overlays): Update.
Fixes #227
---
swiper.el | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/swiper.el b/swiper.el
index 1b2d906..cfc80cd 100644
--- a/swiper.el
+++ b/swiper.el
@@ -201,14 +201,18 @@
(swiper-font-lock-ensure)
(while (< (point) (point-max))
(let ((str (concat " " (buffer-substring
- (line-beginning-position)
- (line-end-position)))))
+ (point)
+ (if visual-line-mode
+ (save-excursion
+ (end-of-visual-line)
+ (point))
+ (line-end-position))))))
(put-text-property 0 1 'display
(format swiper--format-spec
(cl-incf line-number))
str)
(push str candidates))
- (forward-line 1))
+ (line-move 1))
(nreverse candidates))))))
(defvar swiper--opoint 1
@@ -318,7 +322,7 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
(goto-char (point-min))
(when (cl-plusp num)
(goto-char (point-min))
- (forward-line (1- num))
+ (line-move (1- num))
(if (and (equal ivy-text "")
(>= swiper--opoint (line-beginning-position))
(<= swiper--opoint (line-end-position)))
@@ -334,9 +338,17 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
(defun swiper--add-overlays (re &optional beg end)
"Add overlays for RE regexp in visible part of the current buffer.
BEG and END, when specified, are the point bounds."
- (let ((ov (make-overlay
- (line-beginning-position)
- (1+ (line-end-position)))))
+ (let ((ov (if visual-line-mode
+ (make-overlay
+ (save-excursion
+ (beginning-of-visual-line)
+ (point))
+ (save-excursion
+ (end-of-visual-line)
+ (point)))
+ (make-overlay
+ (line-beginning-position)
+ (1+ (line-end-position))))))
(overlay-put ov 'face 'swiper-line-face)
(overlay-put ov 'window (ivy-state-window ivy-last))
(push ov swiper--overlays)
@@ -377,7 +389,7 @@ BEG and END, when specified, are the point bounds."
(if (null x)
(user-error "No candidates")
(goto-char (point-min))
- (forward-line (1- (read (get-text-property 0 'display x))))
+ (line-move (1- (read (get-text-property 0 'display x))))
(re-search-forward
(ivy--regex input) (line-end-position) t)
(swiper--ensure-visible)
- [elpa] master updated (a0561bf -> 1f3fa31), Oleh Krehel, 2015/12/08
- [elpa] master a71d5c8 001/167: ivy.el (ivy--insert-prompt): Improve truncation, Oleh Krehel, 2015/12/08
- [elpa] master e70ca07 003/167: ivy.el (ivy-call): "C-M-n" should not leave the minibuffer, Oleh Krehel, 2015/12/08
- [elpa] master 4ad797b 002/167: Improve "C-g" out of a long-running async process, Oleh Krehel, 2015/12/08
- [elpa] master 41b5850 005/167: ivy.el (ivy--regex-fuzzy): Add minibuffer highlighting, Oleh Krehel, 2015/12/08
- [elpa] master 19d2a40 004/167: Add flx sorting, Oleh Krehel, 2015/12/08
- [elpa] master 3146501 010/167: ivy.el (ivy-resume): Don't regexp-quote preselect, Oleh Krehel, 2015/12/08
- [elpa] master f04aec8 009/167: ivy-hydra.el: Bind "t" to toggle-truncate-lines, Oleh Krehel, 2015/12/08
- [elpa] master 82a317c 011/167: Make swiper compatible with visual-line-mode,
Oleh Krehel <=
- [elpa] master 45b54e3 015/167: counsel.el (counsel--gg-count): Fix for "'" in query, Oleh Krehel, 2015/12/08
- [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