Skip to content

Commit

Permalink
small optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
dheijl committed Oct 30, 2024
1 parent b95b98a commit c359c51
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/ui/mainform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,12 +662,14 @@ impl MainForm {
}

pub fn add_log_msg(&mut self, msg: &str) {
self.tb.buffer().unwrap().append(msg);
self.tb.buffer().unwrap().append("\n");
let buflen = self.tb.buffer().unwrap().length();
self.tb.set_insert_position(buflen);
let buflines = self.tb.count_lines(0, buflen, true);
self.tb.scroll(buflines, 0);
if let Some(mut textbuffer) = self.tb.buffer() {
textbuffer.append(msg);
textbuffer.append("\n");
let buflen = textbuffer.length();
self.tb.set_insert_position(buflen);
let buflines = self.tb.count_lines(0, buflen, true);
self.tb.scroll(buflines, 0);
}
}

pub fn add_renderer_button(&mut self, new_renderer: &Renderer) {
Expand Down

0 comments on commit c359c51

Please sign in to comment.