Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nyxt scheme callback logic #3421

Merged
merged 4 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions source/help.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -476,17 +476,22 @@ The value is saved to clipboard."
:class "container"
(:main
(:nav
(:nbutton :text "Quick-Start"
(:nbutton
:text "Quick-Start"
:title "Display a short tutorial on a side panel."
'(quick-start))
(:a :class "button" :href (nyxt-url 'describe-bindings)
:title "List all bindings for the current buffer."
"Describe-Bindings")
(:a :class "button" :href (nyxt-url 'manual)
:title "Full documentation about Nyxt, how it works and how to configure it."
"Manual")
(:a :class "button" :href (nyxt-url 'common-settings)
:title "Switch between Emacs/vi/CUA key bindings, set home page URL, and zoom level."
"Settings"))
(:nbutton
:text "Describe-Bindings"
:title "List all keyboard shortcuts for the current buffer."
'(make-buffer-focus :url (nyxt-url 'describe-bindings)))
(:nbutton
:text "Manual"
:title "Detailed Nyxt documentation including configuration guides."
'(make-buffer-focus :url (nyxt-url 'manual)))
(:nbutton
:text "Settings"
:title "Set keyboard shortcuts (CUA/Emacs/vi), homepage URL or zoom."
'(make-buffer-focus :url (nyxt-url 'common-settings))))
(:div :class "main"
(:div :class "logo" (:raw (glyph-logo *browser*)))
(:div
Expand Down
3 changes: 1 addition & 2 deletions source/panel.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ panel."))

(defun find-panel-buffer (name)
"Return first panel buffer which URL is a NAME `panel-page'."
(find name (panel-buffers (current-window))
:key (alex:compose #'internal-page-name #'url)))
(find name (panel-buffers (current-window)) :key (compose #'internal-page-name #'url)))

(defmethod set-internal-page-method ((page panel-page) form)
(when form
Expand Down
3 changes: 2 additions & 1 deletion source/renderer-script.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,9 @@ See `find-internal-page-buffer'."))
"Return first buffer which URL is a NAME `internal-page'."
(find name (buffer-list) :key (compose #'internal-page-name #'url)))

(-> find-url-internal-page ((or quri:uri string null)) internal-page)
(defun find-url-internal-page (url)
"Return the `internal-page' to which URL corresponds."
"Return the `internal-page' corresponding to URL."
(gethash (internal-page-name url) *nyxt-url-commands*))

(export-always 'buffer-load-internal-page-focus)
Expand Down
10 changes: 5 additions & 5 deletions source/urls.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,12 @@ ARGS is an arbitrary keyword arguments list that is translated to a URL query."
(lambda (url)
(let* ((%url (quri:uri url))
(internal-page (find-url-internal-page %url)))
;; So that `find-internal-page-buffer' returns a non-nil value.
(when (not (panel-page-p internal-page))
(setf (slot-value (current-buffer) 'url) %url))
(if internal-page
(let ((buffer (current-buffer)))
;; Allow `find-internal-page-buffer' to find it.
(when buffer (setf (slot-value buffer 'url) %url))
(apply (form internal-page)
(query-params->arglist (quri:uri-query-params %url))))
(apply (form internal-page)
(query-params->arglist (quri:uri-query-params %url)))
(warn "No internal page corresponds to URL ~a" %url)))))

(define-internal-scheme "nyxt-resource"
Expand Down