From 3f6ad1bc30570348297ae4aa6d1fd676de229a09 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 24 Sep 2026 10:06:08 -0300 Subject: Ask from the keyboard which neighbour a closed pane's rows go to Del takes a side: `Del k` gives the closed pane's rows to the nearest expanded pane above it, `Del j` to the one below, each falling back to the other side when it has none. DelAbove and DelBelow are those two lines, with no path of their own under SPC. A bare Del started from a key -- SPC d, Enter on the tag word, a row run from an output buffer -- on a pane with expanded panes both above and below asks instead of guessing. The question is a prompt like Save's or a search's (Pane.Prompt.del_side), so it is painted on the pane's notice band by the same path, and the next key answers it before any mode sees it: k or Up, j or Down, anything else keeps the pane, as does a click. Only a key press sets Pardes.can_ask, so a click, a 9P ctl or event write, a startup line, a restore and a shell exiting all close the pane at once, the rows going where layout.absorbVWeight has always sent them. A collapsed pane is not asked about (it has only a tag row to give), and collapsed neighbours are passed over (layout.expandedNeighbor, which Collapse now uses too). removePane and absorbVWeight take the recipient; every other caller passes null. Three scripts that closed a middle pane with SPC d answer k, which is where the rows went before, and their goldens are unchanged. delask.snap covers the question, Esc, j, a clicked DelBelow and a clicked Del. Co-Authored-By: Claude Opus 5.5 (1M context) --- test/snapshots/delask.snap | 71 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 test/snapshots/delask.snap (limited to 'test/snapshots/delask.snap') diff --git a/test/snapshots/delask.snap b/test/snapshots/delask.snap new file mode 100644 index 00000000..04bc850c --- /dev/null +++ b/test/snapshots/delask.snap @@ -0,0 +1,71 @@ +# Del from the keyboard on a pane with open panes above AND below asks, on the +# pane's notice band, which one takes its rows: k above, j below, anything else +# keeps the pane. A click, and DelAbove/DelBelow (Del k / Del j), never ask. +file top.txt top-marker +start 36 100 top.txt +wait 8000 top-marker +stable 700 20000 +# two scratch panes below the file, each saying which it is, then focus the +# middle one +key space f n +stable 400 5000 +key i +text middle-pane +key esc +settle 100 +key space f n +stable 400 5000 +key i +text bottom-pane +key esc +settle 100 +key c-w k +stable 400 5000 +snap three +# asked, and nothing closes yet +key space d +stable 400 5000 +snap asked +# Esc takes the question back: the pane stays +key esc +settle 100 +stable 400 5000 +snap kept +# j: the pane below grows over the middle one's rows, the file keeps its own +key space d +stable 400 5000 +key j +stable 700 10000 +snap below-took +# a pane under it, and DelBelow (Del j) appended to the middle one's text and +# executed with a click: no question, the pane below takes the rows +key space f n +stable 400 5000 +key i +text third-pane +key esc +settle 100 +key c-w k +stable 400 5000 +key A +send \x20DelBelow +key esc +settle 100 +stable 400 5000 +snap typed +press middle @DelBelow 21 +release middle @DelBelow 21 +stable 700 10000 +snap below-took-click +# a fresh pane between the file and the third one, closed by a middle click +# on its tag's Del: no question, and the rows go up as they always have +press left 10 5 +release left 10 5 +stable 400 5000 +key space f n +stable 400 5000 +snap four +press middle @Del 12 +release middle @Del 12 +stable 700 10000 +snap mouse-del -- cgit v1.3