Filter syntax /pattern and / pattern - clic - Clic is an command line interactive client for gopher written in Common LISP HTML git clone git://bitreich.org/clic/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/clic/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit a7fb4e4758b562ca2c69e370619794b421263528 DIR parent f8678efc9938f34c2d873fe85c9d41015b1c7c4f HTML Author: Solene Rapenne <solene@perso.pw> Date: Tue, 23 Jan 2018 19:34:43 +0100 Filter syntax /pattern and / pattern Diffstat: M clic.lisp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- DIR diff --git a/clic.lisp b/clic.lisp @@ -329,7 +329,7 @@ ;; with only lines matching the string (no regex) (loop for line across *previous-buffer* do - (when (search text line :test #'char-equal) + (when (search text (car (split (subseq line 1) #\Tab)) :test #'char-equal) (vector-push line *buffer*))) (display-buffer "1")) @@ -462,7 +462,14 @@ (p)) ;; search a pattern in a menu - ;; search should return 0 if we use it + ;; syntax /pattern + ((and + (search "/" input) + (> (length input) 1)) + (filter-line (subseq input 1))) + + ;; same as previously + ;; but with syntax / pattern ((= 0 (or (search "/ " input) 1)) (filter-line (subseq input 2)))