Naive number highlighting
This commit is contained in:
parent
7c68bc8a88
commit
49807ec9fe
20
src/row.rs
20
src/row.rs
@ -1,5 +1,6 @@
|
|||||||
use crate::SearchDirection;
|
use crate::SearchDirection;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
use termion::color;
|
||||||
use unicode_segmentation::UnicodeSegmentation;
|
use unicode_segmentation::UnicodeSegmentation;
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
@ -30,10 +31,21 @@ impl Row {
|
|||||||
.skip(start)
|
.skip(start)
|
||||||
.take(end - start)
|
.take(end - start)
|
||||||
{
|
{
|
||||||
if grapheme == "\t" {
|
if let Some(c) = grapheme.chars().next() {
|
||||||
result.push_str(" ");
|
if c == '\t' {
|
||||||
} else {
|
result.push_str(" ");
|
||||||
result.push_str(grapheme);
|
} else if c.is_ascii_digit() {
|
||||||
|
result.push_str(
|
||||||
|
&format!(
|
||||||
|
"{}{}{}",
|
||||||
|
color::Fg(color::Rgb(220, 163, 163)),
|
||||||
|
c,
|
||||||
|
color::Fg(color::Reset)
|
||||||
|
)[..],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
result.push(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user