branch: master
commit 3216d4060b9614428c1fcf87f324ca83c97d6d24
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
swiper.el (swiper-avy): Warn if no input
---
swiper.el | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/swiper.el b/swiper.el
index 0092b7f..224d13e 100644
--- a/swiper.el
+++ b/swiper.el
@@ -234,11 +234,13 @@
(interactive)
(unless (require 'avy nil 'noerror)
(error "Package avy isn't installed"))
- (unless (string= ivy-text "")
- (when (= 1 (length ivy-text))
- (let ((swiper-min-highlight 1))
- (swiper--update-input-ivy)))
- (swiper--avy-goto (swiper--avy-candidate))))
+ (cl-case (length ivy-text)
+ (0
+ (user-error "Need at least one char of input"))
+ (1
+ (let ((swiper-min-highlight 1))
+ (swiper--update-input-ivy))))
+ (swiper--avy-goto (swiper--avy-candidate)))
(declare-function mc/create-fake-cursor-at-point "ext:multiple-cursors-core")
(declare-function multiple-cursors-mode "ext:multiple-cursors-core")