theodore-norvell / PLAAY

Senior Design Project PLAAY (Programming Language for Adults And Youth)
2 stars 0 forks source link

Shift-arrow keys and escape key #74

Open theodore-norvell opened 7 years ago

theodore-norvell commented 7 years ago

Here are some more keyboard shortcuts.

shift-right arrow. Expand the selection to the right. shift-left arrow. Expand the selection to the left. shift-down arrow. Bigger expand the selection to the right. shift-up arrow. Bigger expand the selection to the left. Escape. Select the parent.

Details:

Select the parent:

Change the selection consisting of only the parent of the current selection. If the parent is the root, the edit will fail and there will be no change to the current selection.

Expand the selection to the right:

If the focus is less than the number of children the parent has, expand (or shrink) the current selection by incrementing the focus by 1. Otherwise it's the same as "Select the parent."

Expand the selection to the left:

If the focus is greater than zero, expand (or shrink) the current selection by decrementing the focus by 1. Otherwise it's the same as "Select the parent".

Bigger expand the selection to the right.

Repeat "Expand the selection to the right" at least once (if possible) until either it fails or the parent is a vertically laid out node.

Bigger expand the selection to the left.

Similar, but to the left.

theodore-norvell commented 7 years ago

Changed escape key to space character since it is easier to type, some keyboards (e.g. for tablets) don't have escape key, and I haven't thought of anything better for space to mean.

theodore-norvell commented 6 years ago

Completed.

theodore-norvell commented 6 years ago

I'm not perfectly happy with this. Two things bug me and I think they can both be fixed.

On the first focus move, put a pair consisting of the current path and anchor into the selection.

When a focus move would make the selection empty, first try going down by extending the focus path using an item from the saved anchor path. If that is not possible, swap the focus and anchor and update the original anchor path to reflect the swap.

theodore-norvell commented 6 years ago

I implemented part of the above. When the size of the selection is 1, the selection will swap anchor and focus to prevent the selection from becoming empty.

But it does not yet climb back down the tree.