Skip to content

Commit

Permalink
buffer: Fix bug.
Browse files Browse the repository at this point in the history
Improves responsiveness and accuracy when invoking the set-url command.

Fixes #3349.

See commit 36589e3.
  • Loading branch information
aadcg committed Mar 1, 2024
1 parent 177d4ce commit 8b00a2f
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions source/buffer.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -1408,9 +1408,12 @@ Otherwise, set `engine' to `default-search-engine'."))
;; First check engine: if set, no need to change anything.
nil)
((valid-url-p (query query)
:check-dns-p check-dns-p)
:check-dns-p nil)
;; Valid URLs should be passed forward.
nil)
((and check-dns-p
(valid-tld-p (query query)))
(setf (query query) (str:concat "https://" (query query))))
;; Rest is for invalid URLs:
((uiop:file-exists-p (query query))
(setf (query query)
Expand All @@ -1419,11 +1422,6 @@ Otherwise, set `engine' to `default-search-engine'."))
(uiop:native-namestring
(uiop:ensure-absolute-pathname
(query query) *default-pathname-defaults*)))))
((and check-dns-p
(valid-url-p (str:concat "https://" (query query))
:check-dns-p check-dns-p))
(setf (query query)
(str:concat "https://" (query query))))
(t
(setf (engine query)
(or (engine query)
Expand Down Expand Up @@ -1519,7 +1517,14 @@ Otherwise, set `engine' to `default-search-engine'."))
(prompter:filter-preprocessor
(lambda (suggestions source input)
(declare (ignore suggestions source))
(input->queries input :check-dns-p nil :engine-completion-p t)))
(input->queries input :check-dns-p t :engine-completion-p nil)))
(prompter:filter-postprocessor
(lambda (suggestions source input)
(declare (ignore source))
;; Avoid long computations until the user has finished the query.
(sleep 0.15)
(append suggestions
(input->queries input :check-dns-p nil :engine-completion-p t))))
(prompter:filter nil)
(prompter:actions-on-return #'buffer-load*))
(:export-class-name-p t)
Expand Down

0 comments on commit 8b00a2f

Please sign in to comment.