From 3f888888aa1c76ca1e27b6d021c76eb712569f55 Mon Sep 17 00:00:00 2001 From: cage Date: Fri, 1 Mar 2024 18:43:17 +0100 Subject: [PATCH] - used a keyword as the value that signals that a command has been cancleled instrad of 'nil'. --- configure | 20 ++++++++++---------- src/api-client.lisp | 2 +- src/command-window.lisp | 4 +++- src/package.lisp | 2 ++ src/ui-goodies.lisp | 15 ++++++++------- src/windows.lisp | 7 ++++++- 6 files changed, 30 insertions(+), 20 deletions(-) diff --git a/configure b/configure index 42c84ea..bfdb88b 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for tinmop 0.9.9.14142135. +# Generated by GNU Autoconf 2.71 for tinmop 0.9.9.141421356-rc1. # # Report bugs to . # @@ -611,8 +611,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='tinmop' PACKAGE_TARNAME='tinmop' -PACKAGE_VERSION='0.9.9.14142135' -PACKAGE_STRING='tinmop 0.9.9.14142135' +PACKAGE_VERSION='0.9.9.141421356-rc1' +PACKAGE_STRING='tinmop 0.9.9.141421356-rc1' PACKAGE_BUGREPORT='https://codeberg.org/cage/tinmop/' PACKAGE_URL='https://www.autistici.org/interzona/tinmop.html' @@ -1318,7 +1318,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures tinmop 0.9.9.14142135 to adapt to many kinds of systems. +\`configure' configures tinmop 0.9.9.141421356-rc1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1389,7 +1389,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of tinmop 0.9.9.14142135:";; + short | recursive ) echo "Configuration of tinmop 0.9.9.141421356-rc1:";; esac cat <<\_ACEOF @@ -1494,7 +1494,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -tinmop configure 0.9.9.14142135 +tinmop configure 0.9.9.141421356-rc1 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1698,7 +1698,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by tinmop $as_me 0.9.9.14142135, which was +It was created by tinmop $as_me 0.9.9.141421356-rc1, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -2960,7 +2960,7 @@ fi # Define the identity of the package. PACKAGE='tinmop' - VERSION='0.9.9.14142135' + VERSION='0.9.9.141421356-rc1' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -8446,7 +8446,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by tinmop $as_me 0.9.9.14142135, which was +This file was extended by tinmop $as_me 0.9.9.141421356-rc1, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -8506,7 +8506,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -tinmop config.status 0.9.9.14142135 +tinmop config.status 0.9.9.141421356-rc1 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/src/api-client.lisp b/src/api-client.lisp index e8cef84..442408d 100644 --- a/src/api-client.lisp +++ b/src/api-client.lisp @@ -235,7 +235,7 @@ Returns nil if the user did not provided a server in the configuration file" (save-credentials () (let* ((message (_ "Please enter below the file where to save the address")) (filepath (ui:input-dialog-immediate message))) - (when (not (eq filepath :canceled)) + (when (not (windows:input-dialog-canceled-p filepath)) (cond ((null filepath) (save-credentials)) diff --git a/src/command-window.lisp b/src/command-window.lisp index 671fcbd..96eb36f 100644 --- a/src/command-window.lisp +++ b/src/command-window.lisp @@ -16,6 +16,8 @@ (in-package :command-window) +(define-constant +user-input-event-canceled+ :canceled :test #'eq) + (defclass command-window (wrapper-window point-tracker) ((command-line :initform () @@ -481,7 +483,7 @@ command line." (program-events:condition-variable event-to-answer)))) (setf (box:dunbox (program-events:payload input-done-event)) (if canceled - :canceled + +user-input-event-canceled+ command-line)) (program-events:push-event input-done-event)))) diff --git a/src/package.lisp b/src/package.lisp index efa878f..8c2d311 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -1999,6 +1999,7 @@ (:local-nicknames (:c :croatoan) (:c-dlg #:de.anvi.croatoan.dialog)) (:export + :input-dialog-canceled-p :key-config-holder :key-config :tree-holder @@ -2658,6 +2659,7 @@ (:import-from :keybindings-window :update-keybindings-tree) (:local-nicknames (:c :croatoan)) (:export + :+user-input-event-canceled+ :print-error :command-window :command-line diff --git a/src/ui-goodies.lisp b/src/ui-goodies.lisp index ac7f971..d8f2b73 100644 --- a/src/ui-goodies.lisp +++ b/src/ui-goodies.lisp @@ -182,10 +182,10 @@ (title (_ "Error")) (append-ok-button t)) (let ((dialog-window (windows:make-error-message-dialog *main-window* - title - message - buttons - append-ok-button))) + title + message + buttons + append-ok-button))) (windows:menu-select dialog-window))) (defun input-dialog-immediate (message) @@ -249,9 +249,10 @@ (condition-wait condition-variable lock)) (setf (command-window:echo-character *command-window*) nil) (let ((input-string (box:dunbox (payload event)))) - (if (stringp input-string) - (funcall on-input-complete-fn input-string) - (info-message (_ "Command cancelled"))))))))) + (if (eq input-string + command-window:+user-input-event-canceled+) + (info-message (_ "Command cancelled")) + (funcall on-input-complete-fn input-string)))))))) (make-thread #'thread-fn))) (defun thread-go-up () diff --git a/src/windows.lisp b/src/windows.lisp index 3059d8d..47b2800 100644 --- a/src/windows.lisp +++ b/src/windows.lisp @@ -16,6 +16,11 @@ (in-package :windows) +(define-constant +input-dialog-selected-cancel+ :cancel :test #'eq) + +(defun input-dialog-canceled-p (results) + (eq results +input-dialog-selected-cancel+)) + (defclass key-config-holder () ((key-config :initform nil @@ -654,7 +659,7 @@ inserted by the user" (setf (c:cursor-visible-p screen-low-level) nil) (win-close window) (if (null res) - :canceled + +input-dialog-selected-cancel+ (c:value field)))))) (defun make-checklist-dialog (screen parent title options)