From 8deb702090aaa54f1c1444e6a564a4240818611c Mon Sep 17 00:00:00 2001 From: cage Date: Sat, 2 Mar 2024 16:23:05 +0100 Subject: [PATCH] - [TUI] refactored quitting dialog test code in a function. --- src/line-oriented-window.lisp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/line-oriented-window.lisp b/src/line-oriented-window.lisp index cacbd55..fdb3e27 100644 --- a/src/line-oriented-window.lisp +++ b/src/line-oriented-window.lisp @@ -497,6 +497,10 @@ this exact quantity would go beyond the length or rows or zero." (declare (ignore redraw)) t) +(defun event-quit-blocking-list-dialog-window-p (event) + (or (string= event "q") + (string= event "^G"))) + (defun make-blocking-list-dialog-window (screen all-fields text-lines callback &optional (title (_ "Information"))) "Draw a window with a scrollable list of entries, pressing enter @@ -548,8 +552,7 @@ will fire the `callback' function (with the selected field from `all-fields' (draw) (loop named inner for c = (tui:decode-key-event (c:get-wide-event low-level-window)) - while (and (string/= c "q") - (string/= c "^G")) + while (not (event-quit-blocking-list-dialog-window-p c)) do (cond ((string= c :key-arrow-up)