rschmitt / heatseeker

A high-performance Selecta clone, written in Rust.
MIT License
214 stars 10 forks source link

parse ansi colors? #23

Closed hh9527 closed 5 years ago

hh9527 commented 7 years ago

so we can use like this:

rg --color ansi unwrap_or | hs | xargs vi 

skim (https://github.com/lotabout/skim) support this feature.

rschmitt commented 7 years ago

Can you explain exactly how it is "parsing" the ANSI color codes?

hh9527 commented 7 years ago

Can you explain exactly how it is "parsing" the ANSI color codes?

In this command:

rg --color ansi unwrap_or | hs | xargs vi

rg --color ansi unwrap_or will output stream with color escaped sequence, and hs could parsing it, and add some additional highlight colors to it, like this:

file1.rs:10 foo.unwrap_or(Foo::default())

unwrap_or is highlighted by rg

after hs process, it will display (assume user input 'def'):

file1.rs:10 foo.unwrap_or(Foo::default())

def is highlighted by hs

rschmitt commented 7 years ago

Currently, ANSI color codes pass through heatseeker more or less transparently. Is the idea for heatseeker to strip color codes from the choices it writes to stdout?