diff --git a/gui/dialogs/nasal-console.xml b/gui/dialogs/nasal-console.xml index fbfa44f4b..c3a3cebf8 100644 --- a/gui/dialogs/nasal-console.xml +++ b/gui/dialogs/nasal-console.xml @@ -111,8 +111,39 @@ 1 - Clear + Copy to Clipboard Ctrl-c + Copy buffer contents to clipboard + true + + nasal + + + + dialog-update + editfield + + + + + Paste from Clipboard + Ctrl-v + Paste clipboard contents into active buffer + true + + nasal + + + + dialog-update + editfield + + + + + Clear + Ctrl-x + Clear buffer true nasal @@ -127,6 +158,7 @@ Dump Ctrl-d + Dump buffer contents to console true dialog-apply @@ -181,6 +213,17 @@ select(active); } + var copy = func { + gui.dialog_apply("nasal-console", "editfield"); + select(active); + clipboard.setText( edit.getValue() ); + } + + var paste = func { + edit.setValue( clipboard.getText() ); + select(active); + } + var execute = func(what = nil) { var num = what != nil ? what.getIndex() : active; var tag = "<nasal-console/#" ~ num ~ ">"; @@ -216,6 +259,21 @@ dlg.getNode("active").setIntValue(active = which); edit.setValue(dlg.getChild("code", active).getValue()); } + var get_button_desc = func (b) { + var sep = " ... "; + var key=b.getChild("key"); + var desc=b.getChild("key-desc"); + if( !isa(key, props.Node) or !isa(desc, props.Node) ) + return ""; + return " "~key.getValue() ~sep~desc.getValue() ~"\n"; + } + + var key_bindings = (func { + var desc = ""; + var buttons = self.getNode("group[2]").getChildren("button"); + foreach(var b; buttons) desc ~= get_button_desc(b); + return desc; + })(); var help = func { active = 0; @@ -225,8 +283,7 @@ edit.setValue("Keys:\n" ~ " tab ... leave edit mode (visible text cursor)\n" ~ " return ... execute active code\n" - ~ " ctrl-c ... clear input field\n" - ~ " ctrl-d ... dump input field contents to terminal\n" + ~ key_bindings ~ " esc ... close dialog\n\n" ~ "Ctrl-click on tab buttons executes code without\n" ~ "switching to the tab. Add more <code> properties\n"