Merge branch 'main' into worktree-improvise-ewi-formula-crate
# Conflicts: # src/ui/app.rs # src/ui/effect.rs # src/view/layout.rs
This commit is contained in:
@ -3,6 +3,7 @@ use crate::ui::app::AppMode;
|
||||
use crate::ui::effect::{self, Effect};
|
||||
|
||||
use super::core::{Cmd, CmdContext};
|
||||
use super::grid::AddRecordRow;
|
||||
use super::navigation::{CursorState, EnterAdvance, viewport_effects};
|
||||
|
||||
#[cfg(test)]
|
||||
@ -259,15 +260,31 @@ impl Cmd for CommitAndAdvance {
|
||||
}
|
||||
AdvanceDir::Right => {
|
||||
let col_max = self.cursor.col_count.saturating_sub(1);
|
||||
let nc = (self.cursor.col + 1).min(col_max);
|
||||
effects.extend(viewport_effects(
|
||||
self.cursor.row,
|
||||
nc,
|
||||
self.cursor.row_offset,
|
||||
self.cursor.col_offset,
|
||||
self.cursor.visible_rows,
|
||||
self.cursor.visible_cols,
|
||||
));
|
||||
let row_max = self.cursor.row_count.saturating_sub(1);
|
||||
let at_bottom_right = self.cursor.row >= row_max && self.cursor.col >= col_max;
|
||||
|
||||
if at_bottom_right && ctx.is_records_mode() {
|
||||
let add = AddRecordRow;
|
||||
effects.extend(add.execute(ctx));
|
||||
effects.extend(viewport_effects(
|
||||
self.cursor.row + 1,
|
||||
0,
|
||||
self.cursor.row_offset,
|
||||
self.cursor.col_offset,
|
||||
self.cursor.visible_rows,
|
||||
self.cursor.visible_cols,
|
||||
));
|
||||
} else {
|
||||
let nc = (self.cursor.col + 1).min(col_max);
|
||||
effects.extend(viewport_effects(
|
||||
self.cursor.row,
|
||||
nc,
|
||||
self.cursor.row_offset,
|
||||
self.cursor.col_offset,
|
||||
self.cursor.visible_rows,
|
||||
self.cursor.visible_cols,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
effects.push(Box::new(effect::EnterEditAtCursor));
|
||||
|
||||
Reference in New Issue
Block a user