Skip to content

Commit

Permalink
update on any change
Browse files Browse the repository at this point in the history
  • Loading branch information
Vandesm14 committed Jun 13, 2024
1 parent f0f8d25 commit 212d257
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions stack-debugger/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ impl DebuggerApp {

impl eframe::App for DebuggerApp {
fn update(&mut self, ctx: &egui::Context, _: &mut eframe::Frame) {
let last_index = self.index;

if self.do_reload.try_iter().last().is_some() {
self.reload();
}
Expand Down Expand Up @@ -279,8 +281,6 @@ impl eframe::App for DebuggerApp {
egui::CentralPanel::default().show(ctx, |ui| {
ctx.set_pixels_per_point(1.2);

let last_index = self.index;

if !self.prints.is_empty() {
ui.add_space(10.0);
}
Expand Down Expand Up @@ -380,24 +380,6 @@ impl eframe::App for DebuggerApp {
)
});

// Update stack
match self.index.cmp(&last_index) {
Ordering::Greater => self
.context
.journal()
.as_ref()
.unwrap()
.construct_from_to(&mut self.stack, last_index, self.index),
Ordering::Less => self
.context
.journal()
.as_ref()
.unwrap()
.construct_to_from(&mut self.stack, self.index, last_index),

_ => {}
}

let mut layout_job = LayoutJob::default();
if let Some(entry) = entry {
if let Some(first) = entry.ops.first() {
Expand Down Expand Up @@ -487,6 +469,24 @@ impl eframe::App for DebuggerApp {
});
});

// Update stack
match self.index.cmp(&last_index) {
Ordering::Greater => self
.context
.journal()
.as_ref()
.unwrap()
.construct_from_to(&mut self.stack, last_index, self.index),
Ordering::Less => self
.context
.journal()
.as_ref()
.unwrap()
.construct_to_from(&mut self.stack, self.index, last_index),

_ => {}
}

ctx.request_repaint_after(Duration::from_secs_f32(1.0 / 15.0));
}
}

0 comments on commit 212d257

Please sign in to comment.