atuin/atuin-common
Peter Holloway ef38fd0a29
Stop control characters being printed to terminal (#1576)
If a previous command in the history contained a literal control
character (eg via Ctrl-v, Ctrl-[), when the command was printed, the
control character was printed and whatever control sequence it was part
of was interpreted by the terminal. For instance, if a command contained
the SGR sequence `^[[31m`,  all subsequent output from `atuin history
list` would be in red.

Slightly less of a problem, control characters would also not appear in
the interactive search widget although they would be printed when
selected. This meant `echo '^[[31foo'` would appear as `echo '[31foo'`.
When the entry was selected, the same problem as before would occur and,
for the example above, `echo 'foo'` would be printed with 'foo' in red.
When copied, this command would not behave the same as the original as
it would be missing the control sequence.

This adds an extension trait to add a method to anything that behaves
like a string to escape ascii control characters and return a string
that can be printed safely. This string can then be copied and run
directly without having to add the control characters back.
2024-01-17 08:58:11 +00:00
..
src Stop control characters being printed to terminal (#1576) 2024-01-17 08:58:11 +00:00
Cargo.toml feat: add semver checking to client requests (#1456) 2023-12-20 09:03:04 +00:00