Use keys to skip empty cells

Tags: #<Tag:0x00007fd2bcc50b20>

Hi there,

I have a rather large table with a lot of columns which is filled rather sparse. So in every row there are a lot of blank cells. By default, I can use the arrow keys to get to the next cell. Is there a possibility to use, e.g. Ctrl + ArrowKey, to get to the next non-empty cell?
And if so, what would be the “cleanest” way of doing it?

thanks a lot for the help.

Good day Stephan,

I recommend using the afterDocumentKeyDown hook.

You’d need to register two keys (previous CTRL/CMD and current ///).
The hook returns only the event itself, but you can refer to the event’s keyCode to create the statement.
After receiving a signal that the key combination is the one to move the selection, you can use the selectCell() method and the getSelected() method to receive selected cell coordinates.

If you’d have any difficulties feel free to share the progress and I’ll do my best to help.

Hi Aleksandra,

I finally found some time to implement it. Your recommendations helped a lot!
If anybody is interested, this is my current solution:

private handledKeys = ['ArrowLeft', 'ArrowRight'];

onBeforeKeyDown = (event) => {
  if ( && event['ctrlKey'] && this.handledKeys.includes(event['key'])) {

onAfterDocumentKeyDown = (event) => {
  if ( && event['ctrlKey'] && this.handledKeys.includes(event['key'])) {
    let row =[0][0];
    let column =[0][1];
    const totalCols =;
    const right = (event['key'] === 'ArrowRight');
    const left = (event['key'] === 'ArrowLeft');
    if (right || left) {
      const incr = right ? 1 : -1;
      do {
        column = this.mod(column + incr, totalCols);
      } while(this.emptyOrNoWidth(row, column));, column);

hotSettings.afterDocumentKeyDown = this.onAfterDocumentKeyDown;
hotSettings.beforeKeyDown = this.onBeforeKeyDown;

private emptyOrNoWidth(row:number, col:number):boolean {
  return < 1 || !, col);

public static mod(n:number, m:number):number {
  return ((n % m) + m) % m;

well done @stephan.boehme !