OSA script: when a single-pane background tab is told to close(), the foreground tab is closed instead
- iTerm2 version: 3.1.beta.9 (also tested with iTerm2-3_1_20170909-nightly)
- OS version: 10.13 Beta (17A360a)
- com.googlecode.iterm2.plist attached
- debuglog.txt attached
Detailed steps to reproduce the problem:
- Open an iTerm2 window with more than one tab, (e.g. three single-pane tabs, "A" (active), "B" & "C".
- Enumerate windows, tabs and sessions via osascript (sample script: sessions.js; call without arguments, optionally pretty-print by piping through jq: e.g.
./sessions.js | jq .). - Call
close()on any single-session tab except the currently selected tab, e.g. tab "C" (sample script: action.js; call with argumentscloseand theidattribute taken from the output ofsessions.js: e.g../action.js close 17956 2 3D94CA74-3E08-451D-A683-3FB1AB77BCE2).
What happened:
- The currently selected tab is closed instead of the targeted tab.
What should have happened:
- The targeted tab should close.
Notes:
- It seems that as long as the tab holding the target session holds more than a single session (e.g. multiple panes),
close()acts as expected and correctly closes the session upon which it is called. -
select()acts as expected, but for the fact that you seem to need to need to select in the particular order "tab" => "session" => "window" => "app" in order to actually bring the desired session to the foreground. Selecting the session before the tab results in similarly unexpected behaviour to the mainclose()bug described above. This can be seen by swapping lines 18 & 19 in the action.js script and and trying to bring a non-selected session, in a non-selected tab to the foreground with, e.g../action.js select 17956 2 3D94CA74-3E08-451D-A683-3FB1AB77BCE2
Edited by Robin Breathe