[Merged] PR #5099: Spreadsheet keyboard navigation and refactoring

Post here if you have re-based and finalised code to integrate into master, which was discussed, agreed to and tested in other forums. You can also submit your PR directly on github.
Post Reply
User avatar
chennes
Veteran
Posts: 2239
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

[Merged] PR #5099: Spreadsheet keyboard navigation and refactoring

Post by chennes »

PR #5099 contains mostly under-the-hood work refactoring Spreadsheet's keyboard event handling to consolidate the locations that deal with moving to the "next" cell on completion. As a consequence, many more keyboard navigation options are available:
  • Home - To the top of current column
  • End - To the bottom of the current column (the last cell with data)
  • Ctrl-Home - To cell A1
  • Ctrl-End - To the last non-empty cell in the highest row that has data in it Update: to the last cell as described by openBrain, below.
  • Ctrl-Arrow - To the last cell in the data block with data in it (e.g. find the first empty cell, stop before it)
  • Tab/Enter - Count the number of tabs, return to the starting column on "Enter"
These shortcuts correspond to those in most other spreadsheet programs.

Update: I also implemented block selection from the keyboard using the shift modifier with the arrow keys.
Chris Hennes
Pioneer Library System
openBrain
Veteran
Posts: 7992
Joined: Fri Nov 09, 2018 5:38 pm

Re: PR #5099: Spreadsheet keyboard navigation and refactoring

Post by openBrain »

If I'm correct, in most programs Ctrl+End is "bottom-right of the used range". I.e. a combination of highest row with data, highest column with data. Even if this particular cell is empty. ;)
User avatar
Shalmeneser
Veteran
Posts: 4738
Joined: Wed Dec 23, 2020 12:04 am
Location: Fr

Re: PR #5099: Spreadsheet keyboard navigation and refactoring

Post by Shalmeneser »

In LibreOffice Calc, Ctrl+End is the left bottom cell of the data bounding box (eventually empty).
(And Ctrl+End+Shift select the (right/bottom) smaller rectangle containing all non-empty cells.)
User avatar
chennes
Veteran
Posts: 2239
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: PR #5099: Spreadsheet keyboard navigation and refactoring

Post by chennes »

I deliberately did not get into three-key combos in this PR, but with the new refactoring it's pretty straightforward for someone to come along after me and code those up: I think it's pretty obvious where in the code you need to do that :). I'll update Ctrl-End, and it turns out I messed up on merged cells, so I have to adjust that behavior as well.
Chris Hennes
Pioneer Library System
User avatar
chennes
Veteran
Posts: 2239
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: PR #5099: Spreadsheet keyboard navigation and refactoring

Post by chennes »

In the end I did wind up supporting one kind of three-key combo: making block selections using the arrow keys, potentially in combination with the control key. So if you hold down control and shift, you can use the arrow keys to quickly select entire data regions.
Chris Hennes
Pioneer Library System
zohozer
Posts: 119
Joined: Mon Jul 28, 2014 8:35 pm

Re: PR #5099: Spreadsheet keyboard navigation and refactoring

Post by zohozer »

I would appreciate to have an option in Spreadsheet when hitting the ENTER key, the cursor to go one cell down and be ready in edit mode. My biggest problem with Spreadsheet is that when I hit enter it continues to edit the current cell which is a wrong behavior imho.
User avatar
chennes
Veteran
Posts: 2239
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: [Merged] PR #5099: Spreadsheet keyboard navigation and refactoring

Post by chennes »

What version? The only case where "enter" doesn't move you down in 0.20dev is supposed to be if you are using the formula editor (you have to hit enter twice then, once to close that editor and once to confirm the edit).
Chris Hennes
Pioneer Library System
Post Reply