micro icon indicating copy to clipboard operation
micro copied to clipboard

Implemented new actions `FirstTab`, `LastTab`, `FirstSplit` and `LastSplit`

Open masmu opened this issue 1 year ago • 1 comments

This PR changes the default behavior of NextTab, PreviousTab, NextSplit, PreviousSplit to not walk in circles anymore but instead splits those actions up into more atomic actions.

So e.g. NextTab just selects the next tab but doesn't switch to the first tab in case you run the action on the last tab. A new action FirstTab has been added and can be chained to restore the original behavior.

"PreviousTab"     ->       "PreviousTab|LastTab",
"NextTab"         ->       "NextTab|FirstTab",
"PreviousSplit"   ->       "PreviousSplit|LastSplit",
"NextSplit"       ->       "NextSplit|FirstSplit",

This adds a lot of flexibility to the user to create more sophisticated keybindings.

The following keybinding allows a combination of split and tab switching:

"Alt-,": "PreviousSplit|PreviousTab|LastTab",
"Alt-.": "NextSplit|NextTab|FirstTab",

masmu avatar Jul 28 '24 07:07 masmu

I have just found another bug concerning the order of the split selection.

When adding a new BufPane it is always being inserted last into MainTab().Panes. This leads to a confusion when using the actions PreviousSplit, NextSplit as the next/previous split may not be the expected one.

How to reproduce:

  • Launch micro and insert char "1"
  • Open a new vsplit via the command vsplit and insert "2"
  • Switch back to the left split (1) by using PreviousSplit
  • Again open a new vsplit via command: vsplit and type char "3"
  • Now switch between the 3 splits using PreviousSplit, NextSplit

Switching from most left split to the most right, the expected order would be 1, 3, 2 but actually is 1, 2, 3.

masmu avatar Aug 17 '24 12:08 masmu

I did. :)

dmaluka avatar Sep 16 '24 20:09 dmaluka

Thanks for your time and the reviews guys. :+1:

masmu avatar Sep 17 '24 20:09 masmu