mirror of
https://github.com/atuinsh/atuin.git
synced 2024-11-25 09:44:03 +01:00
fix: Print literal control characters to non terminals (#1586)
* Print literal control characters to non terminals Previous 'fix' to prevent control sequences being interpreted when they shouldn't have been also prevented them being used when they should have been. This checks if the output is to a terminal (where control sequences shouldn't be interpreted) before escaping control characters. * Update atuin/src/command/client/search.rs Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com> --------- Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
This commit is contained in:
parent
8913d46dab
commit
cda135d241
@ -1,3 +1,5 @@
|
||||
use std::io::{stderr, IsTerminal as _};
|
||||
|
||||
use atuin_common::utils::{self, Escapable as _};
|
||||
use clap::Parser;
|
||||
use eyre::Result;
|
||||
@ -167,7 +169,11 @@ impl Cmd {
|
||||
|
||||
if self.interactive {
|
||||
let item = interactive::history(&self.query, settings, db, &history_store).await?;
|
||||
eprintln!("{}", item.escape_control());
|
||||
if stderr().is_terminal() {
|
||||
eprintln!("{}", item.escape_control());
|
||||
} else {
|
||||
eprintln!("{item}");
|
||||
}
|
||||
} else {
|
||||
let list_mode = ListMode::from_flags(self.human, self.cmd_only);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user