(&mut self, ctx: &egui::Context, action: Option<DiffViewAction>)
| 559 | } |
| 560 | |
| 561 | fn post_update(&mut self, ctx: &egui::Context, action: Option<DiffViewAction>) { |
| 562 | if action.is_some() { |
| 563 | ctx.request_repaint(); |
| 564 | } |
| 565 | |
| 566 | self.appearance.post_update(ctx); |
| 567 | |
| 568 | let ViewState { jobs, diff_state, config_state, graphics_state, .. } = &mut self.view_state; |
| 569 | config_state.post_update(ctx, jobs, &self.state); |
| 570 | diff_state.post_update(action, ctx, jobs, &self.state); |
| 571 | |
| 572 | let Ok(mut state) = self.state.write() else { |
| 573 | return; |
| 574 | }; |
| 575 | let state = &mut *state; |
| 576 | |
| 577 | let mut mod_check = false; |
| 578 | if state.last_mod_check.elapsed().as_millis() >= 500 { |
| 579 | state.last_mod_check = Instant::now(); |
| 580 | mod_check = true; |
| 581 | } |
| 582 | |
| 583 | if mod_check |
| 584 | && let Some(info) = &state.project_config_info |
| 585 | && let Some(last_ts) = info.timestamp |
| 586 | && file_modified(&info.path, last_ts) |
| 587 | { |
| 588 | state.config_change = true; |
| 589 | } |
| 590 | |
| 591 | if state.config_change { |
| 592 | state.config_change = false; |
| 593 | if let Err(e) = load_project_config(state) { |
| 594 | log::error!("Failed to load project config: {e:#}"); |
| 595 | state.show_error_toast("Failed to load project config", &e); |
| 596 | } |
| 597 | } |
| 598 | |
| 599 | if state.watcher_change { |
| 600 | drop(self.watcher.take()); |
| 601 | |
| 602 | if let Some(project_dir) = &state.config.project_dir { |
| 603 | match build_globset(&state.config.watch_patterns) |
| 604 | .map_err(anyhow::Error::new) |
| 605 | .and_then(|patterns| { |
| 606 | build_globset(&state.config.ignore_patterns) |
| 607 | .map(|ignore_patterns| (patterns, ignore_patterns)) |
| 608 | .map_err(anyhow::Error::new) |
| 609 | }) |
| 610 | .and_then(|(patterns, ignore_patterns)| { |
| 611 | create_watcher( |
| 612 | self.modified.clone(), |
| 613 | project_dir.as_ref(), |
| 614 | patterns, |
| 615 | ignore_patterns, |
| 616 | egui_waker(ctx), |
| 617 | ) |
| 618 | .map_err(anyhow::Error::new) |
no test coverage detected