-
Notifications
You must be signed in to change notification settings - Fork 17.4k
Add commands to move directionally between panes #1484
Conversation
- Add keymaps for the new commands. Since the new commands are all about moving in a specific direction between panes, use the up, down, left, and right keys in the keymaps. - Change the keymaps for the existing commands (since the new commands for moving left and right are now using the old keymaps for moving to the previous and next pane respectively). Use "p" instead of "left" in the keymap for focusing the *p*revious pane. Use "n" instead of "right" in the keymap for focusing the *n*ext pane.
[pane1, pane2, pane3, pane4, pane5, pane6, pane7, pane8, pane9] = [] | ||
|
||
beforeEach -> | ||
# Set up a grid of 9 panes, in the following arrangement, where the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this comment block! I'll probably copy this idea somewhere in the future.
distance: (pointA, pointB) -> | ||
x = pointB.x - pointA.x | ||
y = pointB.y - pointA.y | ||
Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be moved to the Point class in Text Buffer.
I tried to shrink the "nearest pane in a certain direction" code a bit. I think it is still understandable, although maybe I should break up |
For real this time
@nathansobo: Thanks for the feedback! @probablycorey: Thanks for the improvements! I'm happy to do the work to incorporate all the feedback and get this across the finish line. I can't promise any particular timeline for getting it done, since I'm still just hacking on this stuff occasionally when I have a free evening. So, if you have time to make the desired improvements before I get to it, that's totally cool. Otherwise, I'll chip away at this as time allows. |
# Public: Focuses the pane directly to the right of the currently-focused | ||
# pane. | ||
focusPaneOnRight: -> @panes.focusPaneOnRight() | ||
|
||
# Public: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comments mention the currently-focused pane, but it should say active pane.
@jasonrudolph I'm pretty happy with it now, it is so handy! I can take this over and merge it in after I make a few small changes. |
I was thinking about moving this to a package because we already have The only reason for keeping |
Please don't removed the cycling behavior. I use it pretty heavily in a 2-pane configuration where directionality isn't relevant. |
But in the two pane case, isn't it actually "focus-previous-tab" On Sunday, February 2, 2014, Nathan Sobo notifications@github.com wrote:
|
I bind |
Add commands to move directionally between panes
I originally implemented this as a package in https://github.com/atom/house-of-pane/pull/1, but following @nathansobo's suggestion, I'm opening this PR as an attempt to bake that package's functionality directly into atom/atom.
Currently, Atom lets you switch focus to the next or previous pane.
When I find myself making the most of split panes (especially on a large display), I often want to be able to quickly move directionally to another pane. I want to tell Atom to move ⬆️, or ⬇️, or ⬅️, or ➡️.
Kinda like this:
This PR is an attempt to provide those commands. As always, I'd appreciate any and all feedback!