Add more navigation#356
Open
Mangepange wants to merge 1 commit intow-ahmad:mainfrom
Open
Conversation
w-ahmad
reviewed
May 5, 2026
| } | ||
| } | ||
|
|
||
| private int CalculateAvailablePageSize() |
Owner
There was a problem hiding this comment.
can we add some info comment on this method?
Comment on lines
+233
to
+250
| else if (e.Key == VirtualKey.Home) | ||
| { | ||
| var row = (ctrlKey ? 0 : CurrentCellSlot?.Row) ?? -1; | ||
| var column = 0; | ||
|
|
||
| var newSlot = new TableViewCellSlot(row, column); | ||
| MakeSelection(newSlot, shiftKey); | ||
| e.Handled = true; | ||
| } | ||
| else if (e.Key == VirtualKey.End) | ||
| { | ||
| var row = (ctrlKey ? _collectionView.Count - 1 : CurrentCellSlot?.Row) ?? -1; | ||
| var column = Columns.VisibleColumns.Count - 1; | ||
|
|
||
| var newSlot = new TableViewCellSlot(row, column); | ||
| MakeSelection(newSlot, shiftKey); | ||
| e.Handled = true; | ||
| } |
Owner
There was a problem hiding this comment.
can we merge these two code blocks because they blocks look almost identical, except for lines 235 and 244, and this difference can be managed with a condition.
Comment on lines
+251
to
+277
| else if (e.Key == VirtualKey.PageDown) | ||
| { | ||
| var pageSize = CalculateAvailablePageSize(); | ||
|
|
||
| var row = (LastSelectionUnit is TableViewSelectionUnit.Row ? CurrentRowIndex : CurrentCellSlot?.Row) ?? -1; | ||
| var column = CurrentCellSlot?.Column ?? -1; | ||
|
|
||
| var numRows = CollectionView.Count; | ||
| var nextRow = Math.Min(numRows - 1, row + pageSize); | ||
|
|
||
| var newSlot = new TableViewCellSlot(nextRow, column); | ||
| MakeSelection(newSlot, shiftKey); | ||
| e.Handled = true; | ||
| } | ||
| else if (e.Key == VirtualKey.PageUp) | ||
| { | ||
| var pageSize = CalculateAvailablePageSize(); | ||
|
|
||
| var row = (LastSelectionUnit is TableViewSelectionUnit.Row ? CurrentRowIndex : CurrentCellSlot?.Row) ?? -1; | ||
| var column = CurrentCellSlot?.Column ?? -1; | ||
|
|
||
| var nextRow = Math.Max(0, row - pageSize); | ||
|
|
||
| var newSlot = new TableViewCellSlot(nextRow, column); | ||
| MakeSelection(newSlot, shiftKey); | ||
| e.Handled = true; | ||
| } |
Owner
There was a problem hiding this comment.
I think these code blocks could be merged as well!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added navigation with
This solves #348
The behavior for when using PgUp/PgDn might work in another way, but I ended up just adding/removing one "pagesize" to the current index to keep it simple.