diff options
| author | user <user@clank> | 2026-08-16 19:25:52 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-16 19:25:52 +0200 |
| commit | 503b309187eaf0bc7282dd09e93c695dba11abb5 (patch) | |
| tree | 420112d1b9ea8416375b7f0cd0b4777ee8137599 /src/config.c | |
| parent | sl0ppty: a pane can change tabs (diff) | |
| download | slosh-503b309187eaf0bc7282dd09e93c695dba11abb5.tar.gz slosh-503b309187eaf0bc7282dd09e93c695dba11abb5.tar.xz slosh-503b309187eaf0bc7282dd09e93c695dba11abb5.zip | |
sl0ppty: `C-a >` sends this pane to the next tab
C-a > push it to the tab after C-a b into a tab of its own
C-a < push it to the tab before
Three actions rather than three special cases in the key handler, which is what
puts them in the cheatsheet and the palette without another line of code -- and
the palette is where you find a thing you did not know to look for.
You do not follow the pane, and a toast says where it went: "moved to tab 2 (api)".
A key you might press twice needs to say what it did, and following would take you
away from what you were doing. The tab's *name* is read before the move and its
*number* after: emptying this tab removes it and shifts everything along, so the
number read first is not the number anybody will see. When the tab you were in is
the one that goes, you arrive in the survivor because there is nowhere to stay.
`>` and `<` are the shifted period and comma, and the defaults bind both halves --
a terminal does not report shift for punctuation, so `>` arrives as a bare period
the way `?` arrives as a bare slash. The config loader already did this for a chord
you write by hand; the defaults had to do it themselves. The cost is that `.` and
`,` are spoken for, which is the cost `/` already pays for `?`. `b` is for break
out, the word tmux taught everybody for this.
**Two things the tests caught, both mine.**
`panes` reported a pane's tab as an index while every command that takes a tab
wants an id -- and my own test conflated them, passing only because the two agree
until a tab is removed, which is half of what these keys do. There is now a
`tab_id` beside the `tab`: one is where it sits in the strip, the other is what you
pass back.
And three more rows overflowed the cheatsheet: `modal_frame` clamps the box to the
screen, so at 56x44 the `session` group was simply not drawn. The sheet now says
`+7 more, in docs/keys.md` when it cannot show everything -- counted by walking the
rows it skipped, because arithmetic on two uneven columns claimed six were hidden
on a screen showing all of them. A list that quietly stops is worse than a short
one: the reader cannot tell that the key they wanted was on it. Reflowing to two
columns when the height forces it would be better than a footnote, and is not this
commit.
Verified: `tests/test_move_pane.py` at 38 checks -- the keys in both directions,
breaking out, the refusal when there is only one tab, pushing the last pane out and
landing in the survivor, and that the sheet prints `>` rather than the bare period
it also answers to while the palette finds it by label. `tests/test_help.py` gained
the short-terminal case and lost an assumption about its own fixture height.
Diffstat (limited to 'src/config.c')
| -rw-r--r-- | src/config.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c index 52188ed..d0cd347 100644 --- a/src/config.c +++ b/src/config.c @@ -25,6 +25,9 @@ static const struct { {"resize-up", ACT_RESIZE_UP}, {"resize-down", ACT_RESIZE_DOWN}, {"equalize", ACT_EQUALIZE}, {"clear-shaders", ACT_CLEAR_SHADERS}, + {"pane-to-next-tab", ACT_PANE_TO_NEXT_TAB}, + {"pane-to-prev-tab", ACT_PANE_TO_PREV_TAB}, + {"pane-to-new-tab", ACT_PANE_TO_NEW_TAB}, {"rotate-layout", ACT_ROTATE_LAYOUT}, {"scroll-up", ACT_SCROLL_UP}, {"scroll-down", ACT_SCROLL_DOWN}, {"scroll-page-up", ACT_SCROLL_PAGE_UP}, @@ -860,6 +863,21 @@ void config_defaults(config_t *c) { * that reaches for the right thing here. Four presses come back round, which * is what makes a key this easy to hit the right choice rather than a hazard. */ bind_add(c, GHOSTTY_KEY_SPACE, 0, ACT_ROTATE_LAYOUT, false); + /* `>` and `<` are the shifted period and comma, which is how the sheet prints + * them and how anybody would type them. Pushing a pane one tab along is the + * cheap version of moving it: no picker, no drag, and the toast says where it + * went since you do not follow it. */ + bind_add(c, GHOSTTY_KEY_PERIOD, MOD_SHIFT, ACT_PANE_TO_NEXT_TAB, false); + bind_add(c, GHOSTTY_KEY_COMMA, MOD_SHIFT, ACT_PANE_TO_PREV_TAB, false); + /* ...and without the shift, because a terminal does not report one for + * punctuation: `>` arrives as a bare period, the way `?` arrives as a bare + * slash. The config loader binds both halves for the same reason when you write + * one of these by hand; the defaults have to do it themselves. The cost is that + * `.` and `,` are spoken for, which is the cost `/` already pays for `?`. */ + bind_add(c, GHOSTTY_KEY_PERIOD, 0, ACT_PANE_TO_NEXT_TAB, false); + bind_add(c, GHOSTTY_KEY_COMMA, 0, ACT_PANE_TO_PREV_TAB, false); + /* `b` for break out, which is the word tmux taught everybody for this. */ + bind_add(c, GHOSTTY_KEY_B, 0, ACT_PANE_TO_NEW_TAB, false); bind_add(c, GHOSTTY_KEY_C, 0, ACT_NEW_TAB, false); /* Cycling tabs is on tab/shift+tab, not on n/p: `p` is the palette, which is * pressed far more often than "the tab before this one" and had the only @@ -927,6 +945,12 @@ static const struct { /* Under `panes`, not `size`: it undoes what the program in the pane did to * the pane, which is a fact about that pane and not about the layout. */ {ACT_CLEAR_SHADERS, "panes", "clear this pane's shaders"}, + /* Under `panes`: what moves is the pane, and the tab it lands in is where it + * lands. A reader looking for "how do I get this thing out of here" looks up + * the thing, not the place. */ + {ACT_PANE_TO_NEXT_TAB, "panes", "push it to the tab after"}, + {ACT_PANE_TO_PREV_TAB, "panes", "push it to the tab before"}, + {ACT_PANE_TO_NEW_TAB, "panes", "into a tab of its own"}, {ACT_ROTATE_LAYOUT, "size", "turn the layout a quarter"}, {ACT_NEW_TAB, "tabs", "new tab"}, |
