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:

  1. Open an iTerm2 window with more than one tab, (e.g. three single-pane tabs, "A" (active), "B" & "C".
  2. 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 .).
  3. Call close() on any single-session tab except the currently selected tab, e.g. tab "C" (sample script: action.js; call with arguments close and the id attribute taken from the output of sessions.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:

  1. 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.
  2. 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 main close() 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 Sep 15, 2017 by Robin Breathe
Assignee Loading
Time tracking Loading