diff --git a/examples/advanced-qml-auto-reload/lisp/swank-quicklisp.lisp b/examples/advanced-qml-auto-reload/lisp/swank-quicklisp.lisp index 55c4244..3f95f8f 100644 --- a/examples/advanced-qml-auto-reload/lisp/swank-quicklisp.lisp +++ b/examples/advanced-qml-auto-reload/lisp/swank-quicklisp.lisp @@ -72,7 +72,6 @@ (define-symbol-macro :q (quicklisp))) (export - (list #+ios - 'start-swank + (list 'start-swank 'stop-swank 'quicklisp)) diff --git a/examples/cl-repl/lisp/dialogs.lisp b/examples/cl-repl/lisp/dialogs.lisp index 0752b64..49ef9fa 100644 --- a/examples/cl-repl/lisp/dialogs.lisp +++ b/examples/cl-repl/lisp/dialogs.lisp @@ -5,6 +5,7 @@ #:debug-dialog #:get-file-name #:exited + #:help #:push-dialog #:pop-dialog #:*file-name*)) @@ -26,8 +27,7 @@ (disable-clipboard-menu) (prog1 (> (q< |depth| ui:*main*) 1) - (qjs |popDialog| ui:*main*) - (exited))) + (qjs |popDialog| ui:*main*))) (defun wait-while-transition () ;; needed for evtl. recursive calls @@ -43,7 +43,6 @@ (q! |forceActiveFocus| ui:*query-input*) (q! |showKeyboard| ui:*main* t) ; needed on recursive calls (wait-for-closed) - (pop-dialog) (qlater (lambda () (editor:ensure-focus :show))) (q< |text| ui:*query-input*)) @@ -66,18 +65,20 @@ (q! |forceActiveFocus| ui:*debug-input*) (qsingle-shot 500 (lambda () (q! |positionViewAtEnd| ui:*debug-text*))) (wait-for-closed) - (pop-dialog) (qlater (lambda () (editor:ensure-focus :show))) (q< |text| ui:*debug-input*)) -(let ((exited t)) +(let (waiting) (defun wait-for-closed () - (setf exited nil) + (setf waiting t) ;; busy waiting is safer than suspending a thread, especially on mobile - (x:while (not exited) - (qsleep 0.1))) + (x:while waiting + (qsleep 0.1)) + (pop-dialog)) (defun exited () ; called from QML - (setf exited t))) + (unless waiting + (pop-dialog)) + (setf waiting nil))) ;; file browser @@ -99,8 +100,9 @@ (qsingle-shot 500 (lambda () (q! |forceActiveFocus| ui:*path*)))))) (defun directory-p (path) - (not (or (pathname-name path) - (pathname-type path)))) + (unless (equal "" path) + (not (or (pathname-name path) + (pathname-type path))))) (defun set-file-name (file-name) ; called from QML (let ((name (remove-if (lambda (ch) (find ch "*?\\")) file-name))) @@ -134,3 +136,7 @@ (unless (x:ends-with "/" url) (setf path* (x:cc url "/"))) (q> |folder| ui:*folder-model* url))) + +(defun help () + (push-dialog :help)) + diff --git a/examples/cl-repl/lisp/editor.lisp b/examples/cl-repl/lisp/editor.lisp index e9874f7..788cf05 100644 --- a/examples/cl-repl/lisp/editor.lisp +++ b/examples/cl-repl/lisp/editor.lisp @@ -658,19 +658,13 @@ (print-eval-output :values "kill: eval thread not running"))) (t (let ((cmd (cond ((cmd ":h") - "(qml:help)") + "(dialogs:help)") ((cmd ":s") "(qml:start-swank)") ((cmd ":q") "(qml:quicklisp)") - ((cmd ":a") - "(require :asdf)") - ((cmd ":f") - "(dialogs:get-file-name)") ((cmd ":c") "(progn (qml:q! |clear| ui:*output-model*) (values))") - ((cmd ":r") - "(editor:reload-qml)") ((cmd "*") (format nil "(progn~% (editor::set-clipboard-text (prin1-to-string *))~% *)")) ((x:starts-with ":? " text*) @@ -1133,7 +1127,8 @@ (change-font :smaller 3)) (eval:ini :output 'print-eval-output :query-dialog 'dialogs:query-dialog - :debug-dialog 'dialogs:debug-dialog)) + :debug-dialog 'dialogs:debug-dialog) + (append-output (format nil "~% :h for help") :bold t)) ;;; quit app diff --git a/examples/cl-repl/lisp/swank-quicklisp.lisp b/examples/cl-repl/lisp/swank-quicklisp.lisp index 55c4244..3f95f8f 100644 --- a/examples/cl-repl/lisp/swank-quicklisp.lisp +++ b/examples/cl-repl/lisp/swank-quicklisp.lisp @@ -72,7 +72,6 @@ (define-symbol-macro :q (quicklisp))) (export - (list #+ios - 'start-swank + (list 'start-swank 'stop-swank 'quicklisp)) diff --git a/examples/cl-repl/qml/ext/DebugDialog.qml b/examples/cl-repl/qml/ext/DebugDialog.qml index dc69bc1..0614eef 100644 --- a/examples/cl-repl/qml/ext/DebugDialog.qml +++ b/examples/cl-repl/qml/ext/DebugDialog.qml @@ -14,12 +14,8 @@ Rectangle { Ext.MenuBack { id: menuBack + Layout.fillWidth: true label: "Debug Dialog" - - onPressed: { - debugInput.text = ":q" - Lisp.call("dialogs:exited") - } } TextField { diff --git a/examples/cl-repl/qml/ext/FileBrowser.qml b/examples/cl-repl/qml/ext/FileBrowser.qml index df25c77..b4075c3 100644 --- a/examples/cl-repl/qml/ext/FileBrowser.qml +++ b/examples/cl-repl/qml/ext/FileBrowser.qml @@ -26,11 +26,6 @@ Rectangle { Ext.MenuBack { id: menuBack - onPressed: { - Lisp.call("dialogs:set-file-name", "") - Lisp.call("dialogs:pop-dialog") - } - Row { id: buttonRow spacing: 4 diff --git a/examples/cl-repl/qml/ext/Help.qml b/examples/cl-repl/qml/ext/Help.qml new file mode 100644 index 0000000..8c9ad6f --- /dev/null +++ b/examples/cl-repl/qml/ext/Help.qml @@ -0,0 +1,43 @@ +import QtQuick 2.15 +import "." as Ext + +Rectangle { + color: "lightyellow" + + Column { + anchors.fill: parent + + Ext.MenuBack { + label: "Help" + } + + Ext.Flickable { + id: flick + width: parent.width + height: parent.height + contentWidth: help.paintedWidth + contentHeight: help.paintedHeight + 75 + + Text { + id: help + width: flick.width + height: flick.height + padding: 20 + wrapMode: Text.WordWrap + font.pixelSize: 20 + text: + "
:? find regular expression, e.g. :? prin[c1]
+* copy result to clipboard
+:s start swank server
+:c clear all output
+:k kill eval thread (long running task)
+double [Space] auto completion, e.g. m-v-b
+tap and hold in the editor to select/copy/paste/eval s-expression, e.g. on defun
+tap and hold cursor buttons to move to beginning/end of line/file
+