Support for reissuing FTCS_COMMAND_START code in the same line (i.e. support for the prompt changing length dynamically)
Thanks for filing an issue! Please answer the questions below so I can help you.
- iTerm2 version: 3.3.12
- OS version: 10.15.5 (19F101)
- Attach ~/Library/Preferences/com.googlecode.iterm2.plist here (drag-drop from finder into this window)
- Attach a debug log, if possible. Instructions at https://iterm2.com/debuglog
- Attach a screen capture video if it would make the reproduction steps clearer.
Detailed steps to reproduce the problem:
I use the Elvish shell and have developed a module for enabling Shell Integration when using Elvish: iterm2.elv.
Everything works great, except for one thing: among other nice features, Elvish updates the prompt in the background as the user types or moves among directories. This means that the prompt may change in length as the user types a command. The example video I uploaded shows an example in which a file gets added to a git repo by a different process, therefore the git indicators in the prompt change as the user types the command.
What happened:
iTerm2 captures the command based only on the first FTCS_COMMAND_START sequence issued (at the end of the original prompt), despite the sequence being issued every time the prompt changes. There are two cases, both shown in the video:
- If the prompt gets longer, the command is captured starting in the original position, which means part of the updated prompt gets captured as part of the command (e.g.
]=> ls
). - If the prompt gets longer, the command is captures starting in the original position, which means the command is only partially captured or (as in the video) not at all, if the original mark is beyond the end of the command after the prompt changes.
Note that the FTCS_COMMAND_START sequence is being reissued every time at the end of the prompt.
What should have happened:
It would be good if iTerm2 considered the latest FTCS_COMMAND_START point when capturing the command, instead of the earliest one. This would allow capturing the command correctly when the prompt changes in length while the user is typing the command.
Thanks for your great work on iTerm2!