feat(advanced_table): Ctrl+N inserts row BELOW current
- Insert at selected_row + 1 instead of at selected_row - Use startInjectedEdit() for proper injection tracking - Row appears below cursor, more intuitive UX
This commit is contained in:
parent
40743b98d2
commit
c6b9bd080a
1 changed files with 4 additions and 4 deletions
|
|
@ -799,16 +799,16 @@ fn handleKeyboard(
|
||||||
// Operaciones CRUD (Ctrl+N, Ctrl+Delete, Ctrl+B desde el Core)
|
// Operaciones CRUD (Ctrl+N, Ctrl+Delete, Ctrl+B desde el Core)
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
if (config.allow_row_operations) {
|
if (config.allow_row_operations) {
|
||||||
// Ctrl+N: Insert row
|
// Ctrl+N: Insert row BELOW current row (inyección local)
|
||||||
if (events.insert_row) {
|
if (events.insert_row) {
|
||||||
const insert_idx: usize = if (table_state.selected_row >= 0)
|
const insert_idx: usize = if (table_state.selected_row >= 0)
|
||||||
@intCast(table_state.selected_row)
|
@as(usize, @intCast(table_state.selected_row)) + 1 // +1 = debajo
|
||||||
else
|
else
|
||||||
0;
|
0;
|
||||||
if (table_state.insertRow(insert_idx)) |new_idx| {
|
if (table_state.insertRow(insert_idx)) |new_idx| {
|
||||||
table_state.selectCell(new_idx, 0);
|
table_state.selectCell(new_idx, 0);
|
||||||
// Inicializar buffer de edición para la nueva fila (Excel-style)
|
// Inicializar buffer para fila inyectada (Excel-style)
|
||||||
table_state.row_edit_buffer.startEdit(table_core.NEW_ROW_ID, new_idx, true);
|
table_state.row_edit_buffer.startInjectedEdit(new_idx);
|
||||||
result.row_inserted = true;
|
result.row_inserted = true;
|
||||||
result.selection_changed = true;
|
result.selection_changed = true;
|
||||||
} else |_| {}
|
} else |_| {}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue