-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand key and Visual Mode selection #83
base: master
Are you sure you want to change the base?
Conversation
ISwapWith visual mode behaviour is obvious to me. The selection range should be equal to or subset of a child node of the list. The selection is serving to choose the child node, the way the cursor does in normal mode. Then the normal mode behaviour is equivalent to visual mode behaviour with a single width selection. ISwap visual mode behaviour I think has two choices
Note that in the second case the normal mode behaviour is not equivalent to visual mode behaviour with a single width selection. but intuitively this seems to make more sense. One argument against the second is that its more keystrokes when trying to deal with lists nested with the same kind of braces: for How do you think visual mode selection should work? |
9c347d9
to
b9de506
Compare
What if cursor was just a special case of range with length 1, for purposes of calculating things? |
Yeah that would be the first solution. I'm just wondering if that's really the best way in terms of utility or intuitive behavior. This branch is in a working state so you can try it out. I've implemented both behaviors controlled by a config variable |
91f1a08
to
2837ab7
Compare
Have you got the chance to try this out? |
not yet... been busy, i will definitely try it by EOD Wednesday |
Flash-confirm highlighting is broken on a case like this: {'a', 'bcdefg'} The By the way, I am certain this is not related to this PR, just something I've noticed. |
Yeah I think its actually related to the refactor of |
New idea implemented, not sure how visually clear it is, but basically it labels the parents of the node, hitting one of those labels relabels which nodes will be swapped (basically the same as hitting expand/shrink a few times). Now EDIT: that second part is done, I feel like ISwapNodeWith should be the default, its fast and flexible |
376e33b
to
9141a4a
Compare
e3a9d2c
to
4134746
Compare
The old behaviour was basically a worse version of the new ISwapNodeWith. now its basically ISwapNodeWith but select two children (can still adjust parent, but may not need to with smart initial parent selection, so its almost always better than ISwap)
will always paint the children+parent labels (so doesn't autoswap on the first iteration) The user either selects child(ren) to swap. Or selects a parent, which may autoswap if only 2 children Is this name good?
No need to take up another keymapping for incremental swapping, The ISwapNodeWith keymapping can satisfy 99% of cases. Also allows selecting the parent to do swaps in, which wasnt possible with incremental swaps before Issues: - everything is refactored to keep ranges rather than tsnodes no longer skips comment nodes as a result - swap_ranges doesn't seem to return the correct new ranges always (known but now is problematic not just visually wrong)
WIP: buggy with move or incremental swap, may be because swap_ranges doesn't return the correct new range.
This branch is based on #81 so that should be merged first.
ISwapNodealready can select arbitrary nestingAddress #79