Skip to content

Commit

Permalink
fix(cli): Avoid Unicode direction isolation marks in CLI output
Browse files Browse the repository at this point in the history
For easier copy/paste from terminals...
  • Loading branch information
alerque committed Aug 27, 2024
1 parent 18331d5 commit 0a5c9f3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 22 deletions.
1 change: 1 addition & 0 deletions src/i18n.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ impl Iterator for BundleIter {
fn next(&mut self) -> Option<Self::Item> {
let locale = self.locales.next()?;
let mut bundle = FluentBundle::new(vec![locale.clone()]);
bundle.set_use_isolating(false);
let mut res_path_scheme = PathBuf::new();
res_path_scheme.push("{locale}");
res_path_scheme.push("{res_id}");
Expand Down
20 changes: 3 additions & 17 deletions src/ui_ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,8 @@ pub struct AsciiJobStatus {
impl AsciiJobStatus {
fn new(target: MakeTarget) -> Self {
if !CONF.get_bool("passthrough").unwrap() {
// Without this, copying the string in the terminal as a word brings a U+2069 with it
// c.f. https://github.com/XAMPPRocky/fluent-templates/issues/72
let mut printable_target: String = target.to_string();
printable_target.push(' ');
let printable_target = style(printable_target).white().bold();
let msg = LocalText::new("make-report-start")
.arg("target", printable_target)
.arg("target", style(target.clone()).white().bold())
.fmt();
let msg = style(msg).yellow().bright();
println!("{msg}");
Expand Down Expand Up @@ -173,12 +168,7 @@ impl JobStatus for AsciiJobStatus {
if CONF.get_bool("passthrough").unwrap() {
return;
}
// Without this, copying the string in the terminal as a word brings a U+2069 with it
// c.f. https://github.com/XAMPPRocky/fluent-templates/issues/72
let mut printable_target: String = self.target.to_string();
printable_target.push(' ');
let target = printable_target;
let target = style(target).white().bold();
let target = style(self.target.clone()).white().bold();
let msg = LocalText::new("make-report-pass")
.arg("target", target)
.fmt();
Expand All @@ -189,11 +179,7 @@ impl JobStatus for AsciiJobStatus {
if CONF.get_bool("passthrough").unwrap() {
return;
}
// Without this, copying the string in the terminal as a word brings a U+2069 with it
let mut printable_target: String = self.target.to_string();
printable_target.push(' ');
let target = printable_target;
let target = style(target).white().bold();
let target = style(self.target.clone()).white().bold();
let msg = LocalText::new("make-report-fail")
.arg("target", target)
.arg("code", code)
Expand Down
6 changes: 1 addition & 5 deletions src/ui_indicatif.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,9 @@ impl std::ops::Deref for IndicatifJobStatus {
impl IndicatifJobStatus {
// pub fn new(ui: &IndicatifInterface, mut target: String) -> Self {
pub fn new(subcommand: &IndicatifSubcommandStatus, target: MakeTarget) -> Self {
// Without this, copying the string in the terminal as a word brings a U+2069 with it
// c.f. https://github.com/XAMPPRocky/fluent-templates/issues/72
let mut printable_target: String = target.to_string();
printable_target.push(' ');
let msg = style(
LocalText::new("make-report-start")
.arg("target", style(printable_target).white().bold())
.arg("target", style(target.clone()).white().bold())
.fmt(),
)
.yellow()
Expand Down

0 comments on commit 0a5c9f3

Please sign in to comment.