dunlin

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 6efbc3457643f09a46f5df295b5ea52a6d831855
parent 261093069039bc41981a392df10121fbe24dba4c
Author: Daniel Barlow <dan@telent.net>
Date:   Fri, 23 Dec 2022 20:27:01 +0000

WIP show prompt for command parameters

Diffstat:
Mcommand.fnl | 20++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/command.fnl b/command.fnl @@ -105,13 +105,14 @@ { :active s.active :error s.error - :prompt (or s.this-param "") + :prompt (if s.active (or s.this-param "Command?" "") "") :default (and param (param)) })) +(local prompt (Gtk.Label { :label ""})) + (fn update-widget-state [w result] - (set w.placeholder_text - (or result.prompt "")) + (set prompt.label (or result.prompt "")) (set w.sensitive result.active) (set w.text (or result.default result.error ""))) @@ -125,10 +126,21 @@ (update-widget-state w (on-input event.text)))) w)) +(local box + (let [box + (Gtk.Box { + :orientation Gtk.Orientation.HORIZONTAL + })] + + (box:pack_start prompt false false 15) + (box:pack_start widget true true 5) + box)) + (fn activate [] (tset state :active true) (set widget.sensitive true) (set widget.text "") + (set prompt.label (or state.this-param "Command" "")) (widget:grab_focus) state) @@ -153,7 +165,7 @@ : define-command : on-input : invoke-interactively - : widget + :widget box :_ { : reset-state }