Skip to content

Commit

Permalink
Underline highlighted lines in ANSI theme
Browse files Browse the repository at this point in the history
  • Loading branch information
mdibaiee committed Jan 18, 2022
1 parent 9287cf6 commit c38883c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- Support for `x:+delta` syntax in line ranges (e.g. `20:+10`). See #1810 (@bojan88)
- Add new `--acknowledgements` option that gives credit to theme and syntax definition authors. See #1971 (@Enselic)
- Include git hash in `bat -V` and `bat --version` output if present. See #1921 (@Enselic)
- Use underline for line highlighting on ANSI, see #1730 (@mdibaiee)

## Bugfixes

Expand Down
Binary file modified assets/syntaxes.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion assets/syntaxes/02_Extra/ssh-config
8 changes: 8 additions & 0 deletions src/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,10 @@ impl<'a> Printer for InteractivePrinter<'a> {
let highlight_this_line =
self.config.highlighted_lines.0.check(line_number) == RangeCheckResult::InRange;

if highlight_this_line && self.config.theme == "ansi" {
self.ansi_style.update("^[4m");
}

let background_color = self
.background_color_highlight
.filter(|_| highlight_this_line);
Expand Down Expand Up @@ -607,6 +611,10 @@ impl<'a> Printer for InteractivePrinter<'a> {
writeln!(handle)?;
}

if highlight_this_line && self.config.theme == "ansi" {
self.ansi_style.update("^[24m");
}

Ok(())
}
}
Expand Down

0 comments on commit c38883c

Please sign in to comment.