From a0b44c5b466d70b0164dbbf6c1d9a50d45e39cd0 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Tue, 8 Oct 2024 21:54:04 -0700 Subject: [PATCH] DeskTop: Fix type-down and tab selection if active window empty Follow-up to ea36d00 which violated the implicit assumption that the set of "selectable icons" was non-empty. It can be, so explicitly check and early-exit. --- desktop/main.s | 12 +++++++++--- res/notes/testplan.md | 3 +++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/desktop/main.s b/desktop/main.s index 80fd010f..71331769 100644 --- a/desktop/main.s +++ b/desktop/main.s @@ -3403,7 +3403,12 @@ next: lda #$00 ;;; Figure out current selected index, based on selection. -common: lda selected_icon_count +common: + ;; Anything selectable? + lda buffer + RTS_IF_EQ + + lda selected_icon_count beq pick_first ;; Try to find actual selection in our list @@ -3506,9 +3511,10 @@ file_char: ;; Collect and sort the potential type-down matches jsr GetNameSelectableIconsSorted + lda num_filenames + beq done - ;; Find a match. There will always be one, since - ;; desktop icons (including Trash) are considered. + ;; Find a match. jsr FindMatch ;; Icon to select diff --git a/res/notes/testplan.md b/res/notes/testplan.md index 0f29271f..b3f3acbd 100644 --- a/res/notes/testplan.md +++ b/res/notes/testplan.md @@ -248,6 +248,9 @@ * Clear selection. Press Shift+Tab repeatedly. Verify that icons in the active window (or desktop if no window is open) are selected in reverse lexicographic order. * Select an icon. Press Shift+Tab. Verify that the previous icon in the active window (or desktop if no window is open) in lexicographic order is selected. +* Open a volume window containing no file icons. Clear selection by clicking on the desktop. Press Tab repeatedly. Verify selection does not change, scrollbars do not appear in the window, and DeskTop does not crash. Close the window. Verify that the volume icon is no longer dimmed. +* Open a volume window containing no file icons. Clear selection by clicking on the desktop. Type 'Z' repeatedly. Verify selection does not change, scrollbars do not appear in the window, and DeskTop does not crash. Close the window. Verify that the volume icon is no longer dimmed. + * Launch DeskTop. Open a volume containing no files. Verify that the default minimum window size is used - about 170px by 50px not counting title/scrollbars.