Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(sheet): fix change selection with tab or enter (#621)

Wenzhao Hucb09fc0b722f
diff --git a/packages/sheets-ui/src/commands/commands/set-selection.command.ts b/packages/sheets-ui/src/commands/commands/set-selection.command.ts
index 9552cce228..a639e29269 100644
--- a/packages/sheets-ui/src/commands/commands/set-selection.command.ts
+++ b/packages/sheets-ui/src/commands/commands/set-selection.command.ts
@@ -106,7 +106,7 @@ export interface IMoveSelectionEnterAndTabCommandParams {
}
/**
- * Move selection for enter and tab
+ * Move selection for enter and tab.
*/
export const MoveSelectionEnterAndTabCommand: ICommand<IMoveSelectionEnterAndTabCommandParams> = {
id: 'sheet.command.move-selection-enter-tab',
@@ -138,14 +138,7 @@ export const MoveSelectionEnterAndTabCommand: ICommand<IMoveSelectionEnterAndTab
let resultRange;
const { startRow, endRow, startColumn, endColumn } = range;
- if (
- !(
- startRow === primary.startRow &&
- endRow === primary.startRow &&
- startColumn === primary.startColumn &&
- endColumn === primary.endColumn
- )
- ) {
+ if (!Rectangle.equals(range, primary)) {
// Handle the situation of moving the active cell within the selection area.
shortcutExperienceService.remove({
unitId,