make promoteActiveFloating -> toggleActiveFloating (works in reverse)

This commit is contained in:
2026-06-05 11:57:41 +02:00
parent 217e865448
commit c762e53bf4
3 changed files with 13 additions and 13 deletions

View File

@@ -180,11 +180,11 @@ public final class Compositor {
layoutVersion++;
}
public void promoteActiveFloating() {
public void toggleActiveFloating() {
if (isEmpty()) {
return;
}
currentTab().promoteActiveFloating();
currentTab().toggleActiveFloating();
layoutVersion++;
}

View File

@@ -244,19 +244,19 @@ final class Tab implements AutoCloseable {
}
/** Promotes the active floating pane to a tiled pane, joining the tiled row. No-op otherwise. */
void promoteActiveFloating() {
TerminalPane promote = active;
if (!floating.remove(promote)) {
return; // active pane is tiled (or there is none); nothing to promote
}
if (promote == lastFocusedFloating) {
void toggleActiveFloating() {
TerminalPane toggled = active;
if (floating.remove(toggled)) {
lastFocusedFloating = floating.isEmpty() ? null : floating.get(floating.size() - 1);
}
tiled.add(promote);
if (floating.isEmpty()) {
tiled.add(toggled);
floatingVisible = false;
setActive(toggled);
} else if (tiled.remove(toggled)) {
lastFocusedTiled = tiled.isEmpty() ? null : tiled.get(tiled.size() -1);
floating.add(toggled);
floatingVisible = true;
setActive(toggled);
}
setActive(promote);
}
void closeActivePane() {

View File

@@ -129,7 +129,7 @@ final class TerminalWindow {
compositor.nextFloatingPane();
event.consume();
} else if (config.keybindings().get("promote_floating").matches(event)) {
compositor.promoteActiveFloating();
compositor.toggleActiveFloating();
event.consume();
} else if (config.keybindings().get("close_pane").matches(event)) {
// Closing the last pane closes this window, via the compositor's onEmpty hook.