scrollback opens in floating pane

This commit is contained in:
2026-06-01 00:46:28 +02:00
parent a51bee3b43
commit ebf87c0bff
3 changed files with 18 additions and 2 deletions

View File

@@ -113,6 +113,16 @@ public final class Compositor {
layoutVersion++; layoutVersion++;
} }
/** Opens a new floating pane, makes it active, and returns it (null when no tab exists). */
public TerminalPane openFloatingPane() {
if (isEmpty()) {
return null;
}
TerminalPane pane = currentTab().createFloatingPane();
layoutVersion++;
return pane;
}
public void nextFloatingPane() { public void nextFloatingPane() {
if (isEmpty()) { if (isEmpty()) {
return; return;

View File

@@ -167,11 +167,16 @@ public final class Main extends Application {
private void openScrollbackInEditor() { private void openScrollbackInEditor() {
try { try {
// Capture the active pane's scrollback before opening the floating pane, since that
// makes the new pane active.
Path file = Files.createTempFile("jprototerm-scrollback-", ".txt"); Path file = Files.createTempFile("jprototerm-scrollback-", ".txt");
Files.writeString(file, compositor.activePane().scrollbackText()); Files.writeString(file, compositor.activePane().scrollbackText());
file.toFile().deleteOnExit(); file.toFile().deleteOnExit();
compositor.activePane().send(scrollbackEditorCommand(file) + "\r"); TerminalPane pane = compositor.openFloatingPane();
if (pane != null) {
pane.send(scrollbackEditorCommand(file) + "\r");
}
} catch (IOException ex) { } catch (IOException ex) {
System.err.println("Could not open scrollback in editor: " + ex.getMessage()); System.err.println("Could not open scrollback in editor: " + ex.getMessage());
} }

View File

@@ -257,11 +257,12 @@ final class Tab implements AutoCloseable {
} }
} }
private void createFloatingPane() { TerminalPane createFloatingPane() {
TerminalPane pane = openPane(true); TerminalPane pane = openPane(true);
floating.add(pane); floating.add(pane);
floatingVisible = true; floatingVisible = true;
setActive(pane); setActive(pane);
return pane;
} }
private boolean navigateFloatingStack(Direction direction) { private boolean navigateFloatingStack(Direction direction) {