Skip to content
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

Add keybinding: moveTabLeft, moveTabRight #3593

Closed
VikingScientist opened this issue Nov 15, 2019 · 18 comments
Closed

Add keybinding: moveTabLeft, moveTabRight #3593

VikingScientist opened this issue Nov 15, 2019 · 18 comments
Assignees
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal good first issue This is a fix that might be easier for someone to do as a first contribution Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@VikingScientist
Copy link

Description of the new feature/enhancement

The list of implemented keybindings is missing the option of moving tabs to the left/right.

I did try and look for this request in other places, but the closest I could find was PR #3478, which implements this functionality as mouse-input by drag & drop, but as far as I could tell it is still missing as keyboard shortcuts.

I saw this mentioned in another thread, but again I was not able to tell if this was just proposed as a request or actually solved.

Proposed technical implementation details (optional)

This should be straightforward: Get the keywords moveTabLeft and moveTabRight in to the list of supported keybindings.

@VikingScientist VikingScientist added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Nov 15, 2019
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Nov 15, 2019
@zadjii-msft
Copy link
Member

I don't hate this idea.

With #3391 merged, we could probably make the ShortcutAction moveTab, so you could do the following:

    { "keys": [ "alt+1" ], "command": { "action": "moveTab", "direction": "left" } },
    { "keys": [ "alt+2" ], "command": { "action": "moveTab", "direction": "right" } },
    { "keys": [ "alt+3" ], "command": { "action": "moveTab", "direction": "left", "amount": 1000 } },
    { "keys": [ "alt+4" ], "command": { "action": "moveTab", "direction": "right", "amount": 3 } },

I don't know why someone would necessarily want to be able to move by a custom amount, but the Alt+3 binding above could be used to move a tab all the way to the first position, so that's an idea.

@zadjii-msft zadjii-msft added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. and removed Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. labels Nov 15, 2019
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Nov 15, 2019
@zadjii-msft zadjii-msft added this to the Terminal Backlog milestone Nov 15, 2019
@zadjii-msft zadjii-msft added the Help Wanted We encourage anyone to jump in on these. label Nov 15, 2019
@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Nov 18, 2019
@dotnetCarpenter
Copy link
Contributor

I'm not sure what the Help Wanted tag means but if you are looking for more use-cases, then I can provide one.

I have set up keybindings for navigating tabs as:

"keybindings": [
    { "command": "prevTab", "keys": ["ctrl+pageup"] },
    { "command": "nextTab", "keys": ["ctrl+pagedown"] }
]

I would ❤️ to setup something similar to move tabs in the same manner.
E.g.

"keybindings": [
    { "command": "prevTab", "keys": ["ctrl+pageup"] },
    { "command": "nextTab", "keys": ["ctrl+pagedown"] },
    { "command": "moveTabBackward", "keys": ["ctrl+shift+pageup"] },
    { "command": "moveTabForward", "keys": ["ctrl+shift+pagedown"] }
]

I do not think that it should cycle through. Rather moving a tab backwards (in LTR languages) should stop at position 0. So that press and holding ctrl+shift+pageup will bring the tab to the first position (far left in LTR). Reversed for ctrl+shift+pagedown also being true of course.

The reason for using "moveTabBackward"/"moveTabForward" instead of "moveTabLeft"/"moveTabRight" is that, in my limited knowledge, in RTL languages (Arabic, Hebrew, Parsi, etc) pageup and pagedown are expected to work in reversed order of LTR languages (European).

@eyalroth
Copy link

@dotnetCarpenter Although I don't believe we'll ever see an RTL layout for the terminal (coming from a Hebrew user here), it's still probably a good idea to name these bindings as "forward" / "backward".

@silverqx
Copy link

Pls finish this proposal, move tabs left/right is one of the latest feature missing 👌, WT has almost everything, I'm waiting for this proposal too, thx WT ftv

@zadjii-msft zadjii-msft added the good first issue This is a fix that might be easier for someone to do as a first contribution label Nov 19, 2020
@Don-Vito
Copy link
Contributor

@zadjii-msft - I can do it. Wondering if we have issues with MRU implementation

@zadjii-msft
Copy link
Member

zadjii-msft commented Nov 19, 2020

Thanks for volunteering! I bet that the MRU ordering definitely will need to be updated as we move the tabs around.

Oh yea that'll be tricky, because after we re-order the tab, we'll need to update the indicies of every other entry in the MRU list.

Though, presumably drag/dropping tabs already does this right, so we should be able to re-use that code...

edit:
Let's make sure to make it forward/backward, as @dotnetCarpenter called out above

    { "command": { "action": "moveTab", "direction": "forward" } },
    { "command": { "action": "moveTab", "direction": "backward" } },
    { "command": { "action": "moveTab", "direction": "forward", "amount": 1000 } },
    { "command": { "action": "moveTab", "direction": "backward", "amount": 3 } },

@Don-Vito
Copy link
Contributor

Thanks for volunteering! I bet that the MRU ordering definitely will need to be updated as we move the tabs around.

Oh yea that'll be tricky, because after we re-order the tab, we'll need to update the indicies of every other entry in the MRU list.

Though, presumably drag/dropping tabs already does this right, so we should be able to re-use that code...

edit:
Let's make sure to make it forward/backward, as @dotnetCarpenter called out above

    { "command": { "action": "moveTab", "direction": "forward" } },
    { "command": { "action": "moveTab", "direction": "backward" } },
    { "command": { "action": "moveTab", "direction": "forward", "amount": 1000 } },
    { "command": { "action": "moveTab", "direction": "backward", "amount": 3 } },

Probably the direction should be: "forward", "backward", "front", "back".
While "forward" and "backward" will have an "amount" field?

@silverqx
Copy link

While "forward" and "backward" will have an "amount" field?

Earlier in this thread was written this:

I don't know why someone would necessarily want to be able to move by a custom amount, but the Alt+3 binding above could be used to move a tab all the way to the first position, so that's an idea.

So to be able to move a tab to the first/last position.

@zadjii-msft
Copy link
Member

I guess that does raise good points. Does { "action": "moveTab", "direction": "backward", "amount": 3 } really have value? Clearly the front/back cases make sense, and they're more semantic than { "action": "moveTab", "direction": "forward", "amount": 1000 } as a synonym for "move to the first position". Using a ridiculous amount for that action works, but it sure seems like front would be more obvious in what it's meant to accomplish.

I suppose it does make more sense to start with a front/back value for direction, and add an amount if there's someone who really wants to be able to move tabs with a keybinding, multiple indices at a time (but not all the way to the front/back).

@silverqx
Copy link

I think amount is unnecessary ( of course it can be implemented too ).

As you propose, much better would be to add a bool flag, which indicates a move to the front/back position and would be good to have the flag with one name, I can't find a good English word for this flag, something that describes the beginning and the end in one word.

@silverqx
Copy link

A good start is to implement the basic functionality and this can be added and decided later ( moving to the first/last position ), it is not so important.

@Don-Vito
Copy link
Contributor

OK. I will start with a basic functionality of moving one tab left/right - let's see if I even succeed 😊

@silverqx
Copy link

silverqx commented Nov 19, 2020

OK. I will start with a basic functionality of moving one tab left/right - let's see if I even succeed 😊

Currently reordering is implemented but only with the mouse, so I would start to look at which functions are used in dragStart / dragEnd handlers, investigate how they work, then look how are implemented keyboard actions, then I would create empty keyboard action and try to reuse logic and functions from dragStart / dragEnd handlers. 😁
I'm pretty sure that it will not be that simple 🤔🙂

@Don-Vito
Copy link
Contributor

Some teasing..
MoveTabs

Now I need to understand if something was broken

@zadjii-msft
Copy link
Member

I'm pretty sure that it will not be that simple 🤔🙂

image

@ghost ghost added the In-PR This issue has a related PR label Nov 19, 2020
@ghost ghost closed this as completed in f5a016c Nov 25, 2020
@ghost ghost added Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed In-PR This issue has a related PR labels Nov 25, 2020
@silverqx
Copy link

Thx, I'm happy about this 👌

@dotnetCarpenter
Copy link
Contributor

Happy to see this in Windows Terminal v1.6.10571.0 today! 🎉 Thanks @Don-Vito!

@silverqx
Copy link

silverqx commented Mar 2, 2021

I tested it now and works great, I like it, but 😀 the animation is painfully slow, it takes more than a second. When I do a quick reorder, then the animation is not applied, this is ok.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal good first issue This is a fix that might be easier for someone to do as a first contribution Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

No branches or pull requests

7 participants