Extra focus reporting events sent on focus-gained when switching between tabs
Thanks for filing an issue! Please answer the questions below so I can help you.
- iTerm2 version: 3.0.12
- OS version: OS X El Capitan 10.11.6
- Attach com.googlecode.iterm2.plist here (drag-drop from finder into this window)
- Attach a debug log, if possible. Instructions at https://iterm2.com/debuglogdebuglog.txt
- Are you reporting a performance issue or a hang? No, only unexpected behavior.
- Are you reporting a crash? Please attach the crash log. No, only unexpected behavior.
Detailed steps to reproduce the problem:
-
Enable focus reporting with the relevant advanced setting
-
Begin with one new tab, and immediately open another.
-
In this second tab, send the 1004 control code to turn focus reporting on for that tab and run a shell command that will reveal which focus events are revealed and when (see below).
-
Switch back and forth between tabs (using the option-command-left and option-command-right accelerators) and between apps (using command-tab). In particular:
- Wait a tick or two, then switch to the original tab. Wait, then switch back.
- Wait a tick or two, then switch to the original tab. Wait, then switch back.
- Wait a tick or two, then switch to a different application. Wait, then switch back.
What happened:
The following text was recorded in the tab with focus reporting turned on.
$ echo -e "\033[?1004h"
$ while true; do sleep 2; echo .; done
.
.
^[[O.
.
^[[I^[[O^[[I.
.
.
^[[O.
.
^[[I^[[O^[[I.
.
.
^[[O.
.
^[[I.
.
^C
$
In the snippet above you can see 3 groups of events, representing the three times I switched away and then back. In the first two groups of events, I switched to another tab and back. In the third I switched to a different app and back.
Notice that in each of the first two event groups, the "focus gained" event has a rider: an extra pair of lost-gain events (^[[O^[[I
). This extra pair of events, I suspect, may be what is confusing vitality, a vim plugin that tries to harness iterm2's focus reporting. In any event, vitality's ability to respond to focus reporting events seems hampered when only switching between tabs.
What should have happened:
In any event, I would expect the reporting behavior for switching between tabs to be the same as switching between applications: the focused tab immediately receives one focus lost event, and later receives exactly one focus gained event.