Skip to content

Commit

Permalink
Wrap around to next row on tab (#395)
Browse files Browse the repository at this point in the history
Co-authored-by: Jarom Madsen <[email protected]>
  • Loading branch information
jarommadsen and Jarom Madsen authored Jun 2, 2024
1 parent 4e553b5 commit b3e36aa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,12 @@ export const go =
if (!state.active) {
return;
}
const size = Matrix.getSize(state.model.data);
const newColumn = state.active.column + columnDelta;
const shouldWrap = newColumn >= size.columns;
const nextActive = {
row: state.active.row + rowDelta,
column: state.active.column + columnDelta,
row: state.active.row + rowDelta + (shouldWrap ? 1 : 0),
column: (state.active.column + columnDelta) % size.columns,
};
if (!Matrix.has(nextActive, state.model.data)) {
return { ...state, mode: "view" };
Expand Down

0 comments on commit b3e36aa

Please sign in to comment.