Skip to content

Commit

Permalink
Merge pull request #3444 from atlas-engineer/review-bookmarks-panel-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
aadcg committed Aug 1, 2024
2 parents aa23142 + 0b78e45 commit c2fc423
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
1 change: 1 addition & 0 deletions source/changelog.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ elements are scaled accordingly.")
(define-version "3.11.8"
(:nsection :title "UI/UX"
(:ul
(:li "Review UI of " (:nxref :command 'nyxt/mode/bookmark:bookmarks-panel) ".")
(:li "Fix mode menu bar."))))

(define-version "3.11.7"
Expand Down
2 changes: 1 addition & 1 deletion source/mode/bookmark.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ against date, given `prompter:active-attributes-keys' configuration."))
(:nsection
:title (or tag "Unsorted")
:id (or tag "unsorted")
:open-p t
:open-p nil
:anchor-p nil
(dolist (bookmark bookmarks)
(:a :href (render-url (url bookmark))
Expand Down
26 changes: 12 additions & 14 deletions source/mode/buffer-listing.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -120,28 +120,26 @@ shown linearly instead."
:class "success"
`(reload-panel-buffer ,panel-buffer))))))

(defun reload-panel-buffer (panel-buffer)
(defun reload-panel-buffer (panel-buffer &optional (window (current-window)))
(reload-buffer (find (render-url (url panel-buffer))
(nyxt::panel-buffers (current-window))
(nyxt::panel-buffers window)
:test #'string=
:key (compose #'render-url #'url))))

(defun buffers-panel-handler-set-buffer (window buffer)
(declare (ignore buffer))
(alex:when-let ((panel-buffer (first (nyxt::panel-buffers window))))
(reload-panel-buffer panel-buffer)))
;; Doesn't take into account the multi-window case. That would require a
;; refactor of the `panel-buffer' class and how panel buffers are found in (setf
;; form) of `internal-page'.
(defun reload-buffers-panel-handler (window buffer)
(declare (ignore window buffer))
(alex:when-let ((buffers-panel (find-panel-buffer 'buffers-panel)))
(reload-panel-buffer buffers-panel)))

(define-configuration window
((window-set-buffer-hook
(hooks:add-hook %slot-default% 'buffers-panel-handler-set-buffer))))

(defun buffers-panel-reload-handler (buffer)
(declare (ignore buffer))
(alex:when-let ((panel-buffer (first (nyxt::panel-buffers (current-window)))))
(reload-panel-buffer panel-buffer)))
(hooks:add-hook %slot-default% 'reload-buffers-panel-handler))))

(define-configuration network-buffer
((buffer-loaded-hook
(hooks:add-hook %slot-default% 'buffers-panel-reload-handler))
(hooks:add-hook %slot-default% (curry #'reload-buffers-panel-handler nil)))
(buffer-delete-hook
(hooks:add-hook %slot-default% 'buffers-panel-reload-handler))))
(hooks:add-hook %slot-default% (curry #'reload-buffers-panel-handler nil)))))
1 change: 1 addition & 0 deletions source/panel.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ When provided, PANELS are deleted instead."
The main difference from `internal-page' is that panel command toggles the
panel."))

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

0 comments on commit c2fc423

Please sign in to comment.