pane sync start != pane sync select
This commit is contained in:
@@ -170,7 +170,8 @@ next_tab = "ALT+SHIFT+L"
|
||||
open_font_selector = "ALT+T"
|
||||
open_scrollback = "ALT+S"
|
||||
create_worktree = "ALT+W"
|
||||
pane_sync_select = "ALT+Y"
|
||||
pane_sync_start = "ALT+Y"
|
||||
pane_sync_select = "SPACE"
|
||||
pane_sync_commit = "ALT+SHIFT+Y"
|
||||
pane_sync_end = "ALT+U"
|
||||
paste = "CTRL+SHIFT+V"
|
||||
@@ -191,7 +192,8 @@ paste = "CTRL+SHIFT+V"
|
||||
- `Alt+s`: open the active pane scrollback in `$EDITOR`
|
||||
- `Alt+w`: edit a worktree name, then run `git worktree add <relative_worktree_path>/<name>`
|
||||
from the previously focused pane's working directory
|
||||
- `Alt+y`: enter pane-sync selection mode and toggle the focused pane in the sync set
|
||||
- `Alt+y`: enter pane-sync selection mode
|
||||
- `Space`: toggle the focused pane in the sync set while pane-sync selection mode is active
|
||||
- `Alt+Shift+y`: commit the current pane-sync selection; input typed or pasted into any synced
|
||||
pane is mirrored to the other synced panes
|
||||
- `Alt+u`: end pane sync
|
||||
|
||||
@@ -41,7 +41,8 @@ next_tab = "ALT+SHIFT+L"
|
||||
open_font_selector = "ALT+T"
|
||||
open_scrollback = "ALT+S"
|
||||
create_worktree = "ALT+W"
|
||||
pane_sync_select = "ALT+Y"
|
||||
pane_sync_start = "ALT+Y"
|
||||
pane_sync_select = "SPACE"
|
||||
pane_sync_commit = "ALT+SHIFT+Y"
|
||||
pane_sync_end = "ALT+U"
|
||||
paste = "CTRL+SHIFT+V"
|
||||
|
||||
@@ -50,6 +50,7 @@ public record AppConfig(
|
||||
"open_font_selector",
|
||||
"open_scrollback",
|
||||
"create_worktree",
|
||||
"pane_sync_start",
|
||||
"pane_sync_select",
|
||||
"pane_sync_commit",
|
||||
"pane_sync_end",
|
||||
@@ -119,7 +120,8 @@ public record AppConfig(
|
||||
Map.entry("open_font_selector", KeyBinding.parse("ALT+T")),
|
||||
Map.entry("open_scrollback", KeyBinding.parse("ALT+S")),
|
||||
Map.entry("create_worktree", KeyBinding.parse("ALT+W")),
|
||||
Map.entry("pane_sync_select", KeyBinding.parse("ALT+Y")),
|
||||
Map.entry("pane_sync_start", KeyBinding.parse("ALT+Y")),
|
||||
Map.entry("pane_sync_select", KeyBinding.parse("SPACE")),
|
||||
Map.entry("pane_sync_commit", KeyBinding.parse("ALT+SHIFT+Y")),
|
||||
Map.entry("pane_sync_end", KeyBinding.parse("ALT+U")),
|
||||
Map.entry("paste", KeyBinding.parse("CTRL+SHIFT+V"))
|
||||
|
||||
@@ -144,14 +144,19 @@ public final class Compositor {
|
||||
return paneSyncSelectMode;
|
||||
}
|
||||
|
||||
public void togglePaneSyncSelection() {
|
||||
TerminalPane active = activePane();
|
||||
if (active == null) {
|
||||
public void startPaneSyncSelection() {
|
||||
if (activePane() == null || paneSyncSelectMode) {
|
||||
return;
|
||||
}
|
||||
if (!paneSyncSelectMode) {
|
||||
paneSyncSelectMode = true;
|
||||
paneSyncSelection.clear();
|
||||
layoutVersion++;
|
||||
}
|
||||
|
||||
public void togglePaneSyncSelection() {
|
||||
TerminalPane active = activePane();
|
||||
if (active == null || !paneSyncSelectMode) {
|
||||
return;
|
||||
}
|
||||
if (!paneSyncSelection.add(active)) {
|
||||
paneSyncSelection.remove(active);
|
||||
|
||||
@@ -72,6 +72,7 @@ final class TerminalWindow {
|
||||
keyActions.put("open_font_selector", this::openFontSelector);
|
||||
keyActions.put("open_scrollback", this::openScrollbackInEditor);
|
||||
keyActions.put("create_worktree", this::createWorktreeInEditor);
|
||||
keyActions.put("pane_sync_start", compositor::startPaneSyncSelection);
|
||||
keyActions.put("pane_sync_select", compositor::togglePaneSyncSelection);
|
||||
keyActions.put("pane_sync_commit", compositor::commitPaneSyncSelection);
|
||||
keyActions.put("pane_sync_end", compositor::endPaneSync);
|
||||
@@ -134,8 +135,12 @@ final class TerminalWindow {
|
||||
|
||||
private void handlePressed(KeyEvent event) {
|
||||
for (Map.Entry<String, Runnable> action : keyActions.entrySet()) {
|
||||
if (config.keybindings().get(action.getKey()).matches(event)) {
|
||||
if (compositor.isPaneSyncSelecting() && !allowedDuringPaneSyncSelection(action.getKey())) {
|
||||
String actionName = action.getKey();
|
||||
if (config.keybindings().get(actionName).matches(event)) {
|
||||
if (actionName.equals("pane_sync_select") && !compositor.isPaneSyncSelecting()) {
|
||||
continue;
|
||||
}
|
||||
if (compositor.isPaneSyncSelecting() && !allowedDuringPaneSyncSelection(actionName)) {
|
||||
event.consume();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user