Trigger-based profile switching into remote machine via tsh/teleport causes 'Paste-Formatting left on' warning popup.

Bug report

Thanks for filing an issue! Please answer the questions below so I can help you.

  • iTerm2 version: Build 3.5.14

  • OS version: Sonoma 15.5 (24F74)

  • Attach ~/Library/Preferences/com.googlecode.iterm2.plist here (drag-drop from finder into this window):

    com.googlecode.iterm2.plist

  • Attach a debug log, if possible.

  • Attach a screen capture video if it would make the reproduction steps clearer.

PLEASE ATTACH YOUR PLIST FILE FOR BUG REPORTS! Seriously! I'll probably ask you for it if you don’t.

Detailed steps to reproduce the problem

  1. Add a trigger to support username and hostname containing period(.), underscore and hyphen:
^([a-zA-Z0-9._-]+)@([a-zA-Z0-9._-]+)
  1. Create new profile with different background color and in automatic switching section add 'abc*' where 'abc' is part of hostname.

  2. tsh (Teleport's secure ssh) into the remote machine: tsh ssh user.na-me@abc-hostname .

    (Note: Since I only have read-only privileges on the remote-machine, no changes in the remote machine is permitted).

What happened

It switches to new profile but it shows 'Paste-Formatting left on' warning after session switch.

What should have happened

It should switch to new profile but should not show 'Paste-Formatting left on' warning.

Honestly, I'm not sure if this is an expected behavior. If it is, please close this issue.

I'll disable 'Paste formatting' for now as workaround.