Skip to content

Commit 39513ee

Browse files
committed
reset list_state on action
1 parent 70f24d8 commit 39513ee

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/vonal_daemon/plugins/launcher/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,15 @@ impl Plugin for Launcher {
114114
self.run(&app.exec, &args);
115115
query.clear();
116116
gl_window.window().set_visible(false);
117+
self.list = Default::default();
117118
}
118119

119120
for action in &app.actions {
120121
if ui.secondary_action(&action.name).activated {
121122
self.run(&action.command, &args);
122123
query.clear();
123124
gl_window.window().set_visible(false);
125+
self.list = Default::default();
124126
}
125127
}
126128
})

src/vonal_daemon/plugins/pass/mod.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use super::{Plugin, PluginFlowControl};
1414

1515
#[derive(Default)]
1616
pub struct Pass {
17-
list_state: ListState,
17+
list: ListState,
1818
config_command_list_passwords: String,
1919
config_command_copy_password: String,
2020
config_command_type_password: String,
@@ -84,6 +84,7 @@ impl Pass {
8484
ui.label(&e.to_string())
8585
} else {
8686
*query = "".into();
87+
self.list = Default::default();
8788
}
8889
}
8990
}
@@ -102,6 +103,7 @@ impl Pass {
102103
ui.label(&e.to_string())
103104
} else {
104105
*query = "".into();
106+
self.list = Default::default();
105107
}
106108
}
107109
}
@@ -133,8 +135,8 @@ impl Plugin for Pass {
133135
match self.list_passwords() {
134136
Ok(passwords) => {
135137
const NUMBER_OF_BUTTONS: usize = 2;
136-
self.list_state.update(ui.ctx(), passwords.len(), |_| NUMBER_OF_BUTTONS);
137-
ui.list(self.list_state, |mut ui| {
138+
self.list.update(ui.ctx(), passwords.len(), |_| NUMBER_OF_BUTTONS);
139+
ui.list(self.list, |mut ui| {
138140
for pw in passwords {
139141
ui.row(|mut ui| {
140142
ui.label(&pw);

0 commit comments

Comments
 (0)