Changeset 11973


Ignore:
Timestamp:
Apr 27, 2009, 4:12:11 PM (11 years ago)
Author:
rme
Message:

Some bug fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/cocoa-ide/search-files.lisp

    r11960 r11973  
    181181(objc:defmethod (#/doSearch: :void) ((wc search-files-window-controller) sender)
    182182  (declare (ignore sender))
    183   (queue-for-gui #'(lambda ()
    184                      (with-slots (outline-view results) wc
    185                        (setf (fill-pointer results) 0)
    186                        (set-results-string wc #@"Searching...")
    187                        (#/startAnimation: (progress-indicator wc) nil)
    188                        (#/reloadData outline-view))))
    189 
     183  (set-results-string wc #@"Searching...")
     184  (setf (find-string-value wc) (#/stringValue (find-combo-box wc))
     185        (folder-string-value wc) (#/stringValue (folder-combo-box wc))
     186        (file-name-string-value wc) (#/stringValue (file-name-combo-box wc)))
    190187  (let* ((find-str (lisp-string-from-nsstring (find-string-value wc)))
    191188         (folder-str (lisp-string-from-nsstring (folder-string-value wc)))
    192189         (file-str (lisp-string-from-nsstring (file-name-string-value wc)))
    193          (grep-args (list (when (recursive-p wc) "-r")
    194                           (unless (case-sensitive-p wc) "-i")
    195                           "-I" "-s" "-c" "-e" find-str "--include" file-str
     190         (grep-args (list "-I" "-s" "-c" "-e" find-str "--include" file-str
    196191                          (get-full-dir-string folder-str))))
     192    (when (recursive-p wc)
     193      (push "-r" grep-args))
     194    (unless (case-sensitive-p wc)
     195      (push "-i" grep-args))
    197196    (setf (search-dir wc) folder-str
    198197          (search-str wc) find-str)
     
    233232  (with-autorelease-pool
    234233      (#/performSelectorOnMainThread:withObject:waitUntilDone:
    235        (progress-indicator wc) (@selector #/startAnimation:) nil nil)
     234       (progress-indicator wc) (@selector #/startAnimation:) nil t)
    236235    (unwind-protect
    237236         (let* ((grep-output (call-grep grep-arglist)))
     
    245244              (@selector #/updateResults:)
    246245              (#/autorelease (%make-nsstring message))
    247               nil)))
     246              t)))
    248247      (#/performSelectorOnMainThread:withObject:waitUntilDone:
    249        (progress-indicator wc) (@selector #/stopAnimation:) nil nil))))
     248       (progress-indicator wc) (@selector #/stopAnimation:) nil t))))
    250249
    251250(defun results-and-message (grep-output wc)
     
    259258         (let* ((colon-pos (position #\: grep-output :from-end t :start start
    260259                                     :end end))
    261                 (count (parse-integer grep-output :start (1+ colon-pos)
    262                                       :end end)))
    263            (incf file-count)
    264            (when (> count 0)
    265              (vector-push-extend (make-search-result-file
    266                                   :name (subseq grep-output
    267                                                 (+ start dir-len)
    268                                                 colon-pos)
    269                                   :lines (make-array count :initial-element nil))
    270                                  results)
    271              (incf occurrences count)))))
     260                (count (and colon-pos
     261                            (parse-integer grep-output :start (1+ colon-pos)
     262                                           :end end))))
     263           (when count
     264             (incf file-count)
     265             (when (> count 0)
     266               (vector-push-extend (make-search-result-file
     267                                    :name (subseq grep-output
     268                                                  (+ start dir-len)
     269                                                  colon-pos)
     270                                    :lines (make-array count :initial-element nil))
     271                                   results)
     272               (incf occurrences count))))))
    272273    (values results
    273274            (format nil "Found ~a occurrence~:p in ~a file~:p out of ~a ~
     
    290291(objc:defmethod (#/doBrowse: :void) ((wc search-files-window-controller) sender)
    291292  (declare (ignore sender))
    292   (let ((dir (choose-directory-dialog)))
    293     (when dir
    294       (with-slots (folder-combo-box) wc
    295         (#/setStringValue: folder-combo-box dir)
    296         (#/updateFolderString: wc folder-combo-box)))))
     293  (let ((pathname (cocoa-choose-directory-dialog)))
     294    (when pathname
     295      (ccl::with-autoreleased-nsstring
     296          (dir (native-translated-namestring pathname))
     297        (with-slots (folder-combo-box) wc
     298          (#/setStringValue: folder-combo-box dir)
     299          (#/updateFolderString: wc folder-combo-box))))))
    297300
    298301(objc:defmethod (#/editLine: :void) ((wc search-files-window-controller) outline-view)
Note: See TracChangeset for help on using the changeset viewer.