Skip to content

Commit

Permalink
Merge remote-tracking branch 'gh/prompt-buffer-arrows'
Browse files Browse the repository at this point in the history
  • Loading branch information
aadcg committed Nov 26, 2023
2 parents 5d36c28 + 6450b4a commit bed40cd
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 36 deletions.
2 changes: 1 addition & 1 deletion _build/prompter
Submodule prompter updated 3 files
+62 −30 guix.scm
+30 −12 prompter.lisp
+41 −0 tests/tests.lisp
3 changes: 3 additions & 0 deletions assets/glyphs/down-arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/glyphs/down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/glyphs/plus-minus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/glyphs/up-arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/glyphs/up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions source/changelog.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,12 @@ Nyxt version exists. It is only raised when the major version differs.")
(:li "When running Nyxt as a Flatpak, programs available on the host can be
invoked via " (:code "flatpak-spawn --host <command> <command-args>") "."))))

(define-version "3.X.Y"
(:nsection :title "UI/UX"
(:ul
(:li "Improve source heading buttons, layout and interactions in the "
(:nxref :class-name 'prompt-buffer) "."))))

(define-version "4-pre-release-1"
(:li "When on pre-release, push " (:code "X-pre-release")
" feature in addition to " (:code "X-pre-release-N") "one."))
Expand Down
88 changes: 53 additions & 35 deletions source/prompt-buffer.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ See `nyxt::attribute-widths'.")
:color ,theme:on-action)
`((:and .button :hover)
:cursor "pointer"
:opacity 0.6)
:color ,theme:action)
`(".button:hover svg path"
:stroke ,theme:action-)
`((:and .button (:or :visited :active))
:color ,theme:background)
`("#input"
Expand All @@ -163,9 +165,14 @@ See `nyxt::attribute-widths'.")
`(".source-name"
:background-color ,theme:secondary
:color ,theme:on-secondary
:padding-left "5px"
:display "flex"
:justify-content "space-between"
:align-items "stretch"
:line-height "24px"
:border-radius "3px 0 0 0")
`(".source-name > div > button"
:padding "5px 4px 5px 4px"
:min-height "100%")
`("#suggestions"
:background-color ,theme:background
:color ,theme:on-background
Expand Down Expand Up @@ -492,39 +499,50 @@ This does not redraw the whole prompt buffer, use `prompt-render' for that."
(last-source-index (1- (length sources))))
(flet ((source->html (source)
(spinneret:with-html-string
(:div :class "source"
(:div :class "source-name"
:style (if (and (hide-single-source-header-p prompt-buffer)
(sera:single sources))
"display:none;"
"display:revert")
(:nbutton
:text ""
:title "Next source"
:buffer prompt-buffer
'(funcall (sym:resolve-symbol :next-source :command)))
(:nbutton
:text ""
:title "Previous source"
:buffer prompt-buffer
'(funcall (sym:resolve-symbol :previous-source :command)))
(:nbutton
:text ""
:title "Toggle attributes display"
:buffer prompt-buffer
`(funcall (sym:resolve-symbol :toggle-attributes-display :command)
:source ,source))
(prompter:name source)
(if (prompter:hide-suggestion-count-p source)
""
(suggestion-and-mark-count prompt-buffer
(prompter:suggestions source)
(prompter:marks source)
:enable-marks-p (prompter:enable-marks-p source)))
(if (prompter:ready-p source)
""
"(In progress...)"))
(:raw (render-attributes source prompt-buffer))))))
(:div.source
(:div.source-name
:style (when (and (hide-single-source-header-p prompt-buffer)
(sera:single sources))
"display:none")
(:div
(:nbutton
:id "next-source"
:text (:raw (gethash "down-arrow.svg" *static-data*))
:title (format nil "Next source (~a)"
(binding-keys (sym:resolve-symbol :next-source
:command)
:modes (modes prompt-buffer)))
:buffer prompt-buffer
'(funcall (sym:resolve-symbol :next-source :command)))
(:nbutton
:id "previous-source"
:text (:raw (gethash "up-arrow.svg" *static-data*))
:title (format nil "Previous source (~a)"
(binding-keys (sym:resolve-symbol :previous-source
:command)
:modes (modes prompt-buffer)))
:buffer prompt-buffer
'(funcall (sym:resolve-symbol :previous-source :command)))
(prompter:name source)
(if (prompter:hide-suggestion-count-p source)
""
(suggestion-and-mark-count prompt-buffer
(prompter:suggestions source)
(prompter:marks source)
:enable-marks-p (prompter:enable-marks-p source)))
(if (prompter:ready-p source) "" "(In progress...)"))
(:div
(:nbutton
:id "toggle-attributes"
:text (:raw (gethash "plus-minus.svg" *static-data*))
:title (format nil "Toggle attributes display (~a)"
(binding-keys (sym:resolve-symbol 'toggle-attributes-display
:command)
:modes (modes prompt-buffer)))
:buffer prompt-buffer
`(funcall (sym:resolve-symbol :toggle-attributes-display :command)
:source ,source))))
(:raw (render-attributes source prompt-buffer))))))
(ps-eval :buffer prompt-buffer
(setf (ps:@ (nyxt/ps:qs document "#suggestions") |innerHTML|)
(ps:lisp
Expand Down

0 comments on commit bed40cd

Please sign in to comment.