Skip to content

Commit

Permalink
Move selection when enter is pressed.
Browse files Browse the repository at this point in the history
  • Loading branch information
anmcgrath committed Mar 22, 2024
1 parent cbd3832 commit 8cfefff
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/BlazorDatasheet/Datasheet.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -482,15 +482,10 @@ private async Task<bool> HandleWindowKeyDown(KeyboardEventArgs e)

if (KeyUtil.IsEnter(e.Key))
{
if (!_sheetLocal.Editor.IsEditing)
return true;

if (AcceptEdit())
{
var movementDir = e.ShiftKey ? -1 : 1;
Sheet?.Selection?.MoveActivePositionByRow(movementDir);
return true;
}
var acceptEdit = Sheet.Editor.IsEditing && AcceptEdit();
var movementDir = e.ShiftKey ? -1 : 1;
Sheet?.Selection?.MoveActivePositionByRow(movementDir);
return acceptEdit;
}

if (KeyUtil.IsArrowKey(e.Key))
Expand Down

0 comments on commit 8cfefff

Please sign in to comment.