You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems the ansi option using Skim as a library is being ignored.
How to reproduce
Create a new cargo project
cargo new skim_ansi
Add skim and ansi_term as libraries. The last one will be used to produce a colored string.
Cargo.toml
[package]
name = "skim_ansi"
version = "0.1.0"
edition = "2018"
[dependencies]
skim = "0.8.1"
ansi_term = "0.12"
Run skim as stated in the documentation, with a colored string generated by ansi_term.
src/main.rs
use skim::prelude::*;use std::io::Cursor;use ansi_term::Colour::Red;fnmain(){// Skim options, ansi is being activatedlet options = SkimOptionsBuilder::default().height(Some("90%")).ansi(true).build().unwrap();// Input line. We use ansi_term to produce a red stringlet input = Red.paint("A red string").to_string();let item_reader = SkimItemReader::default();let items = item_reader.of_bufread(Cursor::new(input));let selected_items = Skim::run_with(&options,Some(items)).map(|out| out.selected_items).unwrap_or_else(|| Vec::new());for item in selected_items.iter(){print!("{}{}", item.output(),"\n");}}
Expected behaviour
The string should be colored while in the skim window
The result should also be colored
Actual behaviour
The string is not colored in the skim window. It appears as ?[31mA red string?[0m.
The result is colored correctly.
The text was updated successfully, but these errors were encountered:
It seems the
ansi
option using Skim as a library is being ignored.How to reproduce
Create a new cargo project
Add
skim
andansi_term
as libraries. The last one will be used to produce a colored string.Cargo.toml
Run skim as stated in the documentation, with a colored string generated by ansi_term.
src/main.rs
Expected behaviour
Actual behaviour
?[31mA red string?[0m
.The text was updated successfully, but these errors were encountered: