mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 06:42:02 +00:00
Handle non-printable characters in diff view (#11687)
Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
parent
ee1621b2f9
commit
ed947792cf
9 changed files with 82 additions and 59 deletions
|
@ -10,6 +10,7 @@ use ruff_diagnostics::{Applicability, Fix};
|
|||
use ruff_source_file::{OneIndexed, SourceFile};
|
||||
|
||||
use crate::message::Message;
|
||||
use crate::text_helpers::ShowNonprinting;
|
||||
|
||||
/// Renders a diff that shows the code fixes.
|
||||
///
|
||||
|
@ -101,6 +102,7 @@ impl Display for Diff<'_> {
|
|||
)?;
|
||||
|
||||
for (emphasized, value) in change.iter_strings_lossy() {
|
||||
let value = value.show_nonprinting();
|
||||
if emphasized {
|
||||
write!(f, "{}", line_style.apply_to(&value).underline().on_black())?;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue