Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,15 @@ impl Config {

/// Tell if colors should be enabled.
///
/// By default, they are except if stdout is not a TTY.
/// By default, they are except if stdout is not a TTY or NO_COLOR
/// environment variable is set.
#[must_use]
pub fn color_mode(&self) -> ColorMode {
if self.color_mode == ColorMode::Enabled
&& std::env::var_os("NO_COLOR").is_some_and(|os| !os.is_empty())
{
return ColorMode::Disabled;
}
self.color_mode
}

Expand Down
2 changes: 1 addition & 1 deletion src/line_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ impl LineBuffer {
true
}

/// Replaces the content between [`start`..`end`] with `text`
/// Replaces the content between `range` with `text`
/// and positions the cursor to the end of text.
pub fn replace<C: ChangeListener>(&mut self, range: Range<usize>, text: &str, cl: &mut C) {
let start = range.start;
Expand Down
Loading