Skip to content

Commit

Permalink
DeskTop: Fix updating of window headers following File > New Folder
Browse files Browse the repository at this point in the history
The wrong path was being used for updating free/used values.
  • Loading branch information
inexorabletash committed Dec 2, 2023
1 parent a0424ed commit 8f944b0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Project Page: https://github.com/a2stuff/a2d
* Remove Special > Lock and Special > Unlock commands.
* Allow selection to remain in inactive windows.
* Fix off-by-one in used/free values in window headers.
* Fix updating of window headers following File > New Folder.

### Selector

Expand Down
16 changes: 9 additions & 7 deletions desktop/main.s
Original file line number Diff line number Diff line change
Expand Up @@ -2395,6 +2395,7 @@ phase: .byte 0
a_path: .addr 0
.endparams

;;; Assert: There is an active window
.proc CmdNewFolderImpl

;; access = destroy/rename/write/read
Expand All @@ -2403,8 +2404,7 @@ a_path: .addr 0
start: copy #NewFolderDialogState::open, new_folder_dialog_params::phase
jsr NewFolderDialogProc

L4FC6: lda active_window_id
beq done ; command should not be active without a window
retry: lda active_window_id
jsr GetWindowPath
stax new_folder_dialog_params::a_path

Expand All @@ -2425,16 +2425,18 @@ L4FC6: lda active_window_id

;; Failure
jsr ShowAlert
jmp L4FC6
jmp retry

success:
copy #NewFolderDialogState::close, new_folder_dialog_params::phase
jsr NewFolderDialogProc
param_call FindLastPathSegment, src_path_buf
sty src_path_buf
jsr FindWindowForSrcPath
beq done

;; Update cached used/free for all same-volume windows
lda active_window_id
jsr GetWindowPath
jsr UpdateUsedFreeViaPath

lda active_window_id
jsr SelectAndRefreshWindowOrClose
bne done

Expand Down
1 change: 1 addition & 0 deletions res/notes/testplan.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
* Open a folder with only one item. File > New Folder. Enter a name and click OK. Verify that the window header says "2 Items"

* Open window for an otherwise empty RAMDisk volume. Note the "K in disk" and "K free" values in the header. File > New Folder. Enter a name and click OK. Verify that the "K in disk" increases by 0 or 1, and that the "K free" decreases by 0 or 1. File > New Folder. Enter another name and click OK. Verify that the "K in disk" increases by 0 or 1, and that the "K free" decreases by 0 or 1.
* Open two windows for different volumes. Note the "items", "K in disk" and "K free" values in the header of the second window. File > New Folder. Enter a name and click OK. Verify that the "items" value increases by one, and "K in disk" increases by 0 or 1, and that the "K free" decreases by 0 or 1.

* Launch DeskTop. Open a window for a removable disk. Quit DeskTop. Remove the disk. Restart DeskTop. Open a different volume's window. Close it. Open it again. Verify that items in the File menu needing a window (New Folder, Close, etc) are correctly enabled.

Expand Down

0 comments on commit 8f944b0

Please sign in to comment.