@@ -1,4 +1,7 @@
1−use crossterm::style::{Color, Print, Stylize};
2+ style::{Color, Print, Stylize},
2use helix_core::config::{default_syntax_loader, user_syntax_loader};
5use helix_core::config::{default_syntax_loader, user_syntax_loader};
3use helix_loader::grammar::load_runtime_file;
6use helix_loader::grammar::load_runtime_file;
4use std::io::Write;
7use std::io::Write;
@@ -106,17 +109,19 @@ pub fn languages_all() -> std::io::Result<()> {
107 let terminal_cols = crossterm::terminal::size().map(|(c, _)| c).unwrap_or(80);
110 let terminal_cols = crossterm::terminal::size().map(|(c, _)| c).unwrap_or(80);
108 let column_width = terminal_cols as usize / headings.len();
111 let column_width = terminal_cols as usize / headings.len();
112+ let is_terminal = std::io::stdout().is_tty();
110 let column = |item: &str, color: Color| {
114 let column = |item: &str, color: Color| {
111− let data = format!(
115+ let mut data = format!(
112 "{:width$}",
116 "{:width$}",
113 item.get(..column_width - 2)
117 item.get(..column_width - 2)
114 .map(|s| format!("{}…", s))
118 .map(|s| format!("{}…", s))
115 .unwrap_or_else(|| item.to_string()),
119 .unwrap_or_else(|| item.to_string()),
116 width = column_width,
120 width = column_width,
118− .stylize()
122+ if is_terminal {
119− .with(color);
123+ data = data.stylize().with(color).to_string();
121 // We can't directly use println!() because of
126 // We can't directly use println!() because of
122 // https://github.com/crossterm-rs/crossterm/issues/589
127 // https://github.com/crossterm-rs/crossterm/issues/589