refactor(ui): ensure layout is rebuilt and use Rc for drill state

Update UI components and effects to ensure layout is rebuilt when necessary.

- Rebuild layout in `EnterEditAtCursor` effect
- Use `Rc` for sharing records in `StartDrill` effect
- Improve formatting in `SetDrillPendingEdit` effect
- Update test case in `App` to use multi-line method calls

Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/gemma-4-26B-A4B-it-GGUF:UD-Q5_K_XL)
This commit is contained in:
Edward Langley
2026-04-06 23:18:40 -07:00
parent 64e9d327db
commit d76efa9e0e
2 changed files with 13 additions and 5 deletions

View File

@ -96,7 +96,11 @@ impl Effect for RemoveFormula {
pub struct EnterEditAtCursor;
impl Effect for EnterEditAtCursor {
fn apply(&self, app: &mut App) {
let ctx = app.cmd_context(crossterm::event::KeyCode::Null, crossterm::event::KeyModifiers::NONE);
app.rebuild_layout();
let ctx = app.cmd_context(
crossterm::event::KeyCode::Null,
crossterm::event::KeyModifiers::NONE,
);
let value = ctx.display_value.clone();
drop(ctx);
app.buffers.insert("edit".to_string(), value);
@ -472,9 +476,10 @@ pub struct SetDrillPendingEdit {
impl Effect for SetDrillPendingEdit {
fn apply(&self, app: &mut App) {
if let Some(drill) = &mut app.drill_state {
drill
.pending_edits
.insert((self.record_idx, self.col_name.clone()), self.new_value.clone());
drill.pending_edits.insert(
(self.record_idx, self.col_name.clone()),
self.new_value.clone(),
);
}
}
}