Skip to content

Commit

Permalink
Change focused cell when tab is pressed while editing
Browse files Browse the repository at this point in the history
  • Loading branch information
nmeylan committed Dec 19, 2024
1 parent 1061d60 commit fecfa1e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/array_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,6 @@ impl<'array> ArrayTable<'array> {
row_index: table_row_index,
is_pinned_column_table: pinned_column_table,
});
ui.ctx().memory_mut(|m| m.request_focus(self.table_id));

} else {
textedit_response.request_focus();
Expand Down Expand Up @@ -1086,6 +1085,9 @@ impl<'array> ArrayTable<'array> {
if response.hovered() {
ui.ctx().set_cursor_icon(CursorIcon::Cell);
}
if updated_value.is_some() {
ui.ctx().memory_mut(|m| m.request_focus(self.table_id));
}
Some(response)
});
}
Expand Down
5 changes: 4 additions & 1 deletion src/object_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ impl ObjectTable {
row_index: table_row_index,
is_pinned_column_table: false,
});
ui.ctx().memory_mut(|m| m.request_focus(self.table_id));

} else {
textedit_response.request_focus();
}

None
} else {
let rect = ui.available_rect_before_wrap();
Expand Down Expand Up @@ -175,6 +175,9 @@ impl ObjectTable {
self.was_editing = true;
}
});
if self.was_editing {
ui.ctx().memory_mut(|m| m.request_focus(self.table_id));
}
array_response
}

Expand Down

0 comments on commit fecfa1e

Please sign in to comment.