diff --git a/tools/clog-builder-search.lisp b/tools/clog-builder-search.lisp index 335e7f5..7a5ce40 100644 --- a/tools/clog-builder-search.lisp +++ b/tools/clog-builder-search.lisp @@ -6,8 +6,8 @@ (*default-border-class* *builder-border-class*) (win (create-gui-window obj :title (format nil "Search in ~A" dir) - :width 600 :height 400 - :client-movement *client-side-movement*)) + :width 600 :height 400 + :client-movement *client-side-movement*)) (panel (create-panel-search (window-content win)))) (setf (text-value (dir-input panel)) dir))) @@ -19,23 +19,26 @@ (declare (ignore target)) (destroy-children (result-box panel)) (let* ((subdirs (checkedp (subdir-check panel))) + (nregex (text-value (name-regex-input panel))) + (sn (ppcre:create-scanner nregex :case-insensitive-mode t)) (regex (text-value (grep-input panel))) (s (ppcre:create-scanner regex :case-insensitive-mode t))) (labels ((do-search (dir prefix) (dolist (item (uiop:directory-files dir)) - (let* ((fname (format nil "~A" item)) - (c (read-file fname :report-errors nil))) - (when (and c - (ppcre:scan s c)) - (let ((li (create-option (result-box panel) - :content (format nil "~A~A" prefix (file-namestring item))))) - (flet ((do-select () - (on-open-file panel :open-file fname - :show-find t - :regex regex))) - (set-on-double-click li (lambda (obj) - (declare (ignore obj)) - (do-select)))))))) + (let ((fname (format nil "~A" item))) + (when (ppcre:scan sn fname) + (let ((c (read-file fname :report-errors nil))) + (when (and c + (ppcre:scan s c)) + (let ((li (create-option (result-box panel) + :content (format nil "~A~A" prefix (file-namestring item))))) + (flet ((do-select () + (on-open-file panel :open-file fname + :show-find t + :regex regex))) + (set-on-double-click li (lambda (obj) + (declare (ignore obj)) + (do-select)))))))))) (when subdirs (dolist (item (uiop:subdirectories dir)) (do-search item (format nil "~A~A/" prefix (first (last (pathname-directory item))))))))) diff --git a/tools/panel-search.clog b/tools/panel-search.clog index 8f7cafa..c4a201f 100644 --- a/tools/panel-search.clog +++ b/tools/panel-search.clog @@ -1,31 +1,35 @@ - +
\ No newline at end of file diff --git a/tools/panel-search.lisp b/tools/panel-search.lisp index 2f8c627..458a724 100644 --- a/tools/panel-search.lisp +++ b/tools/panel-search.lisp @@ -3,37 +3,43 @@ (defclass panel-search (clog:clog-panel) ((search-button :reader search-button) (subdir-label :reader subdir-label) - (subdir-check :reader subdir-check) (grep-input :reader grep-input) - (dir-input :reader dir-input) (result-box :reader result-box) - (result-grid :reader result-grid) (search-form :reader search-form))) + (subdir-check :reader subdir-check) + (name-regex-input :reader name-regex-input) + (grep-input :reader grep-input) (dir-input :reader dir-input) + (result-box :reader result-box) (result-grid :reader result-grid) + (search-form :reader search-form))) (defun create-panel-search (clog-obj &key hidden class style html-id (auto-place t)) (let ((panel (change-class (clog:create-div clog-obj :content - "" @@ -41,28 +47,31 @@ html-id :auto-place auto-place) 'panel-search))) (setf (slot-value panel 'search-button) - (attach-as-child clog-obj "CLOGB3929127599" :clog-type + (attach-as-child clog-obj "CLOGB3929199718" :clog-type 'clog:clog-form-element :new-id t)) (setf (slot-value panel 'subdir-label) - (attach-as-child clog-obj "CLOGB39291277397" :clog-type + (attach-as-child clog-obj "CLOGB3929199717" :clog-type 'clog:clog-label :new-id t)) (setf (slot-value panel 'subdir-check) - (attach-as-child clog-obj "CLOGB39291277016" :clog-type + (attach-as-child clog-obj "CLOGB3929199716" :clog-type + 'clog:clog-form-element :new-id t)) + (setf (slot-value panel 'name-regex-input) + (attach-as-child clog-obj "CLOGB3929199715" :clog-type 'clog:clog-form-element :new-id t)) (setf (slot-value panel 'grep-input) - (attach-as-child clog-obj "CLOGB3929127598" :clog-type + (attach-as-child clog-obj "CLOGB3929199714" :clog-type 'clog:clog-form-element :new-id t)) (setf (slot-value panel 'dir-input) - (attach-as-child clog-obj "CLOGB3929127597" :clog-type + (attach-as-child clog-obj "CLOGB3929199713" :clog-type 'clog:clog-form-element :new-id t)) (setf (slot-value panel 'result-box) - (attach-as-child clog-obj "CLOGB3929127596" :clog-type + (attach-as-child clog-obj "CLOGB3929199712" :clog-type 'clog:clog-select :new-id t)) (setf (slot-value panel 'result-grid) - (attach-as-child clog-obj "CLOGB3929127595" :clog-type + (attach-as-child clog-obj "CLOGB3929199711" :clog-type 'clog:clog-div :new-id t)) (setf (slot-value panel 'search-form) - (attach-as-child clog-obj "CLOGB3929127594" :clog-type + (attach-as-child clog-obj "CLOGB3929199710" :clog-type 'clog:clog-form :new-id t)) (let ((target (grep-input panel))) (declare (ignorable target)) @@ -72,7 +81,7 @@ (declare (ignorable target)) (setf (attribute target "for") (clog:js-query target - "$('[data-clog-name=\\'sundir-check\\']').attr('id')"))) + "$('[data-clog-name=\\'subdir-check\\']').attr('id')"))) (clog:set-on-change (dir-input panel) (lambda (target) (declare (ignorable target))