On 15/06/2024 20:19, Ihor Radchenko wrote:
The underlying cause is limitation of Emacs API for interactive shells - we cannot easily distinguish command output from prompt and other extra staff your shell/other interactive command spits into the buffer. So, we have to either filter output the prompts ourselves to get the command output reliably or redirect output to files, where nothing litters the actual output with prompts.
Some shells support "semantic shell" that allows terminal applications e.g. to copy whole command output. It is based on escape sequences.
- https://docs.kde.org/stable5/en/konsole/konsole/semantic-shell-integration.html - https://gitlab.freedesktop.org/Per_Bothner/specifications/blob/master/proposals/semantic-prompts.md
- https://github.com/tmux/tmux/issues/3064