Skip to content

Commit

Permalink
prompt-buffer(prompt-render-skeleton): Refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
aadcg committed Jun 14, 2024
1 parent db977b6 commit 032f080
Showing 1 changed file with 25 additions and 31 deletions.
56 changes: 25 additions & 31 deletions source/prompt-buffer.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -532,38 +532,32 @@ This does not redraw the whole prompt buffer, use `prompt-render' for that."
+newline+)))))
(prompt-render-prompt prompt-buffer)))

(defun erase-document (prompt-buffer)
(ps-eval :async t :buffer prompt-buffer
(ps:chain document (open))
(ps:chain document (close))))

(defun prompt-render-skeleton (prompt-buffer)
(erase-document prompt-buffer)
(html-set (spinneret:with-html-string
(:head
(:nstyle (style prompt-buffer)))
(:body
(:div :id "prompt-area"
(:div :id "prompt" (prompter:prompt prompt-buffer))
(:div :id "prompt-extra" :class "arrow-right" "[?/?]")
(:div :id "prompt-input"
(:input :type (if (invisible-input-p prompt-buffer)
"password"
"text")
:id "input"
:value (prompter:input prompt-buffer)))
(:div :id "prompt-modes" :class "arrow-left" "")
(:div :id "close-button" :class "arrow-left"
(:nbutton
:text "×"
:title "Close prompt"
:buffer prompt-buffer
'(funcall (sym:resolve-symbol :quit-prompt-buffer :command)))))
(:div :id "suggestions"
:style (if (invisible-input-p prompt-buffer)
"visibility:hidden;"
"visibility:visible;"))))
prompt-buffer))
(html-write (spinneret:with-html-string
(:head (:nstyle (style prompt-buffer)))
(:body
(:div
:id "prompt-area"
(:div :id "prompt" (prompter:prompt prompt-buffer))
(:div :id "prompt-extra" :class "arrow-right" "[?/?]")
(:div :id "prompt-input"
(:input :type (if (invisible-input-p prompt-buffer)
"password"
"text")
:id "input"
:value (prompter:input prompt-buffer)))
(:div :id "prompt-modes" :class "arrow-left" "")
(:div :id "close-button" :class "arrow-left"
(:nbutton
:text "×"
:title "Close prompt"
:buffer prompt-buffer
'(funcall (sym:resolve-symbol :quit-prompt-buffer :command)))))
(:div :id "suggestions"
:style (if (invisible-input-p prompt-buffer)
"visibility:hidden;"
"visibility:visible;"))))
prompt-buffer))

(defun prompt-render-focus (prompt-buffer)
(ps-eval :async t :buffer prompt-buffer
Expand Down

0 comments on commit 032f080

Please sign in to comment.