Skip to content

Fixes #1842 - Add support for toggling selected cells e.g. with space#2386

Merged
tig merged 6 commits intogui-cs:v2from
tznind:tableview-toggle
Mar 2, 2023
Merged

Fixes #1842 - Add support for toggling selected cells e.g. with space#2386
tig merged 6 commits intogui-cs:v2from
tznind:tableview-toggle

Conversation

@tznind
Copy link
Copy Markdown
Collaborator

@tznind tznind commented Mar 1, 2023

Adds support for Command.ToggleChecked to TableView. This allows pure keyboard multi selection (e.g. like you would with Ctrl+Click).

  • Only works when MultiSelect is on
  • No default keybinding. User enables it by registering a keybinding (e.g. tableView.AddKeyBinding (Key.Space, Command.ToggleChecked); )

toggle-selections

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

@tznind tznind changed the title WIP: Add support for toggling selected cells e.g. with space Add support for toggling selected cells e.g. with space Mar 1, 2023
@tznind tznind marked this pull request as ready for review March 1, 2023 19:52
@tznind tznind requested review from migueldeicaza and tig as code owners March 1, 2023 19:52
@tznind
Copy link
Copy Markdown
Collaborator Author

tznind commented Mar 1, 2023

Ready for testing now! This feature is both nice to have and is an actual solution for #1842 (the previous PR was mouse only and there was a workaround in the issue for keyboard). See the issue OP question:

When selecting with the cursor, is it only possible to select consecutive rows? Or is there a keyboard shortcut that allows you to select arbitrary lines?

The answer now is yes! just pick a key and set the keybinding.

In the Scenario I have added this to TableEditor with keybinding of Space and same for the Tests but I don't think we want to claim this key by default as it is quite a niche feature and the key is likely to be bound by existing library users given its prominence.

It will be used in the new FileDialog2 as one of the ways of selecting multiple files files (can still use shift select or ctrl+mouse click).

@tznind tznind changed the title Add support for toggling selected cells e.g. with space Fixes #1842 - Add support for toggling selected cells e.g. with space Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants