diff options
author | Ben Bridle <ben@derelict.engineering> | 2024-11-24 16:19:46 +1300 |
---|---|---|
committer | Ben Bridle <ben@derelict.engineering> | 2024-11-24 16:19:46 +1300 |
commit | 583c961c0158fd44817695225e06d07caa18657e (patch) | |
tree | 8ec633cd67076ddadca9e0014824f22974c5217f /src/devices/file_device | |
parent | b1dbae360b3ed8de5354ffc4677fb3ada1646cfa (diff) | |
download | bedrock-pc-583c961c0158fd44817695225e06d07caa18657e.zip |
Fix file device cached child issue
When opening the previously-visited directory in the file device, the
directory data is read from a cache, preventing the need to have it
regenerated from scratch. The directory data includes the selected
child, which meant that instead of child 0 being selected as per the
specification, the previously-selected child was selected instead.
To fix this, the child is deselected as the directory data is cached.
Diffstat (limited to 'src/devices/file_device')
-rw-r--r-- | src/devices/file_device/directory_listing.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/devices/file_device/directory_listing.rs b/src/devices/file_device/directory_listing.rs index 1d7ddd2..465efc7 100644 --- a/src/devices/file_device/directory_listing.rs +++ b/src/devices/file_device/directory_listing.rs @@ -100,6 +100,11 @@ impl DirectoryListing { } } + pub fn deselect_child(&mut self) { + self.child_path_buffer.clear(); + self.selected = None; + } + pub fn child_path_buffer(&mut self) -> &mut BedrockPathBuffer { &mut self.child_path_buffer } |