From 4a4ee9c912dfbf8c6a428c80a959e6f551965c7f Mon Sep 17 00:00:00 2001 From: Amy <58243358+aymey@users.noreply.github.com> Date: Thu, 29 Feb 2024 23:35:48 +1100 Subject: [PATCH] clear `search_value` on dir load (#88) --- src/file_dialog.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/file_dialog.rs b/src/file_dialog.rs index a0bb3e90..78ad1d9f 100644 --- a/src/file_dialog.rs +++ b/src/file_dialog.rs @@ -54,7 +54,7 @@ pub enum DialogState { /// if ui.button("Select a file").clicked() { /// self.file_dialog.select_file(); /// } -/// +/// /// if let Some(path) = self.file_dialog.update(ctx).selected() { /// println!("Selected file: {:?}", path); /// } @@ -1198,6 +1198,8 @@ impl FileDialog { /// /// The function also sets the loaded directory as the selected item. fn load_directory(&mut self, path: &Path) -> io::Result<()> { + self.search_value.clear(); + let full_path = match fs::canonicalize(path) { Ok(path) => path, Err(err) => {