BlueGit

timfa posprint

Grow the editor TextEdit with available window height.

Co-authored-by: Cursor <cursoragent@cursor.com>

timfa Tim Falken · pushed by timfa

Authored 2026-07-16 · 4 months ago

Hash
3df9468c0d1897756d5e4bcfd2ba5a05c88f6a12
Parent
9e65a463
1 file changed +5 −1
src/app.rs +5 −1
@@ -463,10 +463,14 @@ impl PosPrintApp {
463 463 }
464 464 }
465 465
466 let font_id = egui::TextStyle::Monospace.resolve(ui.style());
467 let row_height = ui.fonts(|f| f.row_height(&font_id)).max(1.0);
468 let rows = ((ui.available_height() / row_height).floor() as usize).clamp(8, 500);
469
466 470 let output = egui::TextEdit::multiline(&mut self.body)
467 471 .id_salt("main_editor")
468 472 .desired_width(f32::INFINITY)
469 .desired_rows(30)
473 .desired_rows(rows)
470 474 .font(egui::TextStyle::Monospace)
471 475 .lock_focus(autocomplete_active)
472 476 .show(ui);
@@ -463,10 +463,14 @@ impl PosPrintApp {
463 }
463 }
464 }
464 }
465
465
466 let font_id = egui::TextStyle::Monospace.resolve(ui.style());
467 let row_height = ui.fonts(|f| f.row_height(&font_id)).max(1.0);
468 let rows = ((ui.available_height() / row_height).floor() as usize).clamp(8, 500);
469
466 let output = egui::TextEdit::multiline(&mut self.body)
470 let output = egui::TextEdit::multiline(&mut self.body)
467 .id_salt("main_editor")
471 .id_salt("main_editor")
468 .desired_width(f32::INFINITY)
472 .desired_width(f32::INFINITY)
469 .desired_rows(30)
473 .desired_rows(rows)
470 .font(egui::TextStyle::Monospace)
474 .font(egui::TextStyle::Monospace)
471 .lock_focus(autocomplete_active)
475 .lock_focus(autocomplete_active)
472 .show(ui);
476 .show(ui);