irongit

fix: not sure what happened on this

huncholanehuncholaneauthored
parent 96314fbcommit 3cd84e5b9e3ee4dcf0bb35db694d459cbd29091bBrowse files

1 file changed, +14 -11

+14-11src/widgets/miller.rs
@@ -176,19 +176,22 @@ impl MillerFilter {
176176 }
177177
178178 let has_focus = r.has_focus();
179+ let lost_focus = r.lost_focus();
179180
180- if has_focus {
181- // Escape: unfocus (don't clear)
182- if ui.input(|i| i.key_pressed(egui::Key::Escape)) {
183- r.surrender_focus();
181+ if has_focus || lost_focus {
182+ if has_focus {
183+ // Escape: unfocus (don't clear)
184+ if ui.input(|i| i.key_pressed(egui::Key::Escape)) {
185+ r.surrender_focus();
186+ }
187+ // Ctrl-N / ArrowDown
188+ resp.next = ui.input(|i| i.key_pressed(egui::Key::ArrowDown))
189+ || ui.input_mut(|i| i.consume_key(egui::Modifiers::CTRL, egui::Key::N));
190+ // Ctrl-P / ArrowUp
191+ resp.prev = ui.input(|i| i.key_pressed(egui::Key::ArrowUp))
192+ || ui.input_mut(|i| i.consume_key(egui::Modifiers::CTRL, egui::Key::P));
184193 }
185- // Ctrl-N / ArrowDown
186- resp.next = ui.input(|i| i.key_pressed(egui::Key::ArrowDown))
187- || ui.input_mut(|i| i.consume_key(egui::Modifiers::CTRL, egui::Key::N));
188- // Ctrl-P / ArrowUp
189- resp.prev = ui.input(|i| i.key_pressed(egui::Key::ArrowUp))
190- || ui.input_mut(|i| i.consume_key(egui::Modifiers::CTRL, egui::Key::P));
191- // Enter
194+ // Enter (check both has_focus and lost_focus since TextEdit surrenders on Enter)
192195 if ui.input(|i| i.key_pressed(egui::Key::Enter)) {
193196 resp.accept = true;
194197 }