Use the same selection expansion logic for Shift-Ctrl-cursor

Expanding the selection from keyboard with Ctrl pressed should move in
the same way Ctrl-cursor does, but use the same selection anchor as
Shift-cursor does instead of always using the current cell.

This makes the expansion work much more intuitively in the grid, e.g.
pressing Shift-Ctrl-Down in

    1 2
    3 4

grid when 1 and 2 are selected now selects all the cells instead of
selecting 1 and 3 as it did before.
This commit is contained in:
Vadim Zeitlin
2020-04-06 02:36:56 +02:00
parent fe6d07d2d1
commit 69a05b0340
2 changed files with 44 additions and 19 deletions

View File

@@ -2767,6 +2767,12 @@ private:
wxGridWindow *gridWindow) const;
int PosToEdgeOfLine(int pos, const wxGridOperations& oper) const;
// Fill the coords with the cell coordinates to use for the movement
// extending the current selection. Return false if, for whatever reason,
// we can't expand the selection at all.
bool PrepareForSelectionExpansion(wxGridCellCoords& coords,
const wxGridDirectionOperations& diroper);
void DoMoveCursorFromKeyboard(const wxKeyboardState& kbdState,
const wxGridDirectionOperations& diroper);
bool DoMoveCursor(const wxKeyboardState& kbdState,