Skip to content

Commit

Permalink
Fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenn committed Aug 24, 2024
1 parent cb173ff commit 606adc1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/highlight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,11 @@ impl MatchingBracketHighlighter {
}
}

#[cfg(any(not(feature = "split-highlight"), feature = "anstyle"))]
#[cfg(any(
not(feature = "split-highlight"),
feature = "anstyle",
feature = "ansi-str"
))]
impl Highlighter for MatchingBracketHighlighter {
#[cfg(all(feature = "split-highlight", not(feature = "ansi-str")))]
type Style = anstyle::Style;
Expand All @@ -264,7 +268,7 @@ impl Highlighter for MatchingBracketHighlighter {
if let Some((matching, idx)) = find_matching_bracket(line, pos, bracket) {
let mut copy = line.to_owned();
copy.replace_range(idx..=idx, &format!("\x1b[1;34m{}\x1b[0m", matching as char));
return Owned(copy);
return Cow::Owned(copy);
}
}
Borrowed(line)
Expand Down
3 changes: 2 additions & 1 deletion src/tty/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use utf8parse::{Parser, Receiver};

use super::{width, Event, RawMode, RawReader, Renderer, Term};
use crate::config::{Behavior, BellStyle, ColorMode, Config};
use crate::highlight::{Highlighter, Style};
use crate::highlight::Highlighter;
use crate::keys::{KeyCode as K, KeyEvent, KeyEvent as E, Modifiers as M};
use crate::layout::{Layout, Position};
use crate::line_buffer::LineBuffer;
Expand Down Expand Up @@ -1010,6 +1010,7 @@ impl Renderer for PosixRenderer {
self.buffer
.push_str(&highlighter.highlight(line, line.pos()));
} else {
use crate::highlight::Style;
for (style, block) in highlighter.highlight_line(line, line.pos()) {
write!(self.buffer, "{}", style.start())?;
self.buffer.push_str(block);
Expand Down

0 comments on commit 606adc1

Please sign in to comment.