-
-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add replace tabs with spaces option #82
Conversation
README.md
Outdated
@@ -389,6 +389,7 @@ miette::set_hook(Box::new(|_| { | |||
.terminal_links(true) | |||
.unicode(false) | |||
.context_lines(3) | |||
.with_tab_width(4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be just .tab_width
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done cb073dd
src/handlers/graphical.rs
Outdated
} | ||
} | ||
|
||
/// Replace tabs with spaces. | ||
pub fn with_tab_width(mut self, width: usize) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to expose .tab_width()
through MietteHandler
, too, since that's the recommended way of customizing your handler in general.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done cb073dd
@@ -30,7 +30,6 @@ impl miette::ReportHandler for LocationHandler { | |||
} | |||
|
|||
fn track_caller(&mut self, location: &'static Location<'static>) { | |||
dbg!(location); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops! :P
@@ -25,6 +25,7 @@ pub struct GraphicalReportHandler { | |||
pub(crate) theme: GraphicalTheme, | |||
pub(crate) footer: Option<String>, | |||
pub(crate) context_lines: usize, | |||
pub(crate) tab_width: Option<usize>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might sound dumb, but I wonder if a user should be allowed to use tab_width = 0
for no space or it'd rather be better if tab_width = 0
means using tabs 🤔
Closes #73
Makes it possible to replace tabs with spaces. This is needed because highlight line renderers are not aware of displayed tab width and appear in wrong places if line contains tabs.