-
-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix vi-mode search feature to work similar to Vim #996
Changes from all commits
d4573e4
161aae3
d99c796
6948422
4c529e5
006111d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -347,30 +347,42 @@ | |
(when (string= "" *isearch-string*) | ||
(setq *isearch-string* (isearch-default-string))) | ||
(setf (variable-value 'isearch-prev-last :buffer) nil) | ||
(cond ((variable-value 'isearch-next-last :buffer) | ||
(setf (variable-value 'isearch-next-last :buffer) nil) | ||
(with-point ((p (current-point))) | ||
(buffer-start p) | ||
(when (funcall *isearch-search-forward-function* p *isearch-string*) | ||
(move-point (current-point) p)))) | ||
((not (funcall *isearch-search-forward-function* (current-point) *isearch-string*)) | ||
(setf (variable-value 'isearch-next-last :buffer) t))) | ||
(isearch-update-display))) | ||
(prog1 | ||
(cond ((variable-value 'isearch-next-last :buffer) | ||
(setf (variable-value 'isearch-next-last :buffer) nil) | ||
(with-point ((p (current-point))) | ||
(buffer-start p) | ||
(if (funcall *isearch-search-forward-function* p *isearch-string*) | ||
(progn | ||
(move-point (current-point) p) | ||
t) | ||
nil))) | ||
((not (funcall *isearch-search-forward-function* (current-point) *isearch-string*)) | ||
(setf (variable-value 'isearch-next-last :buffer) t) | ||
nil) | ||
(t)) | ||
(isearch-update-display)))) | ||
|
||
(define-command isearch-prev () () | ||
(when (boundp '*isearch-string*) | ||
(when (string= "" *isearch-string*) | ||
(setq *isearch-string* (isearch-default-string))) | ||
(setf (variable-value 'isearch-next-last :buffer) nil) | ||
(cond ((variable-value 'isearch-prev-last :buffer) | ||
(setf (variable-value 'isearch-prev-last :buffer) nil) | ||
(with-point ((p (current-point))) | ||
(buffer-end p) | ||
(when (funcall *isearch-search-backward-function* p *isearch-string*) | ||
(move-point (current-point) p)))) | ||
((not (funcall *isearch-search-backward-function* (current-point) *isearch-string*)) | ||
(setf (variable-value 'isearch-prev-last :buffer) t))) | ||
(isearch-update-display))) | ||
(prog1 | ||
(cond ((variable-value 'isearch-prev-last :buffer) | ||
(setf (variable-value 'isearch-prev-last :buffer) nil) | ||
(with-point ((p (current-point))) | ||
(buffer-end p) | ||
(if (funcall *isearch-search-backward-function* p *isearch-string*) | ||
(progn | ||
(move-point (current-point) p) | ||
t) | ||
nil))) | ||
((not (funcall *isearch-search-backward-function* (current-point) *isearch-string*)) | ||
(setf (variable-value 'isearch-prev-last :buffer) t) | ||
nil) | ||
(t)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This returns T. Is this intended? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep. I changed this to return a boolean value as I did to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I understand now 👍 |
||
(isearch-update-display)))) | ||
|
||
(define-command isearch-yank () () | ||
(let ((str (yank-from-clipboard-or-killring))) | ||
|
@@ -383,9 +395,9 @@ | |
(concatenate 'string | ||
*isearch-string* | ||
(string c))) | ||
(with-point ((start-point (current-point))) | ||
(unless (funcall *isearch-search-function* (current-point) *isearch-string*) | ||
(move-point (current-point) start-point))) | ||
(with-point ((point (current-point))) | ||
(unless (funcall *isearch-search-function* point *isearch-string*) | ||
(move-point (current-point) point))) | ||
(isearch-update-display) | ||
t) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to return a boolean value to tell whether the search is successful.