-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
printer: implement --max-columns-preview-before #2683
base: master
Are you sure you want to change the base?
Conversation
@@ -3768,6 +3770,53 @@ fn test_max_columns_preview() { | |||
assert_eq!(false, args.max_columns_preview); | |||
} | |||
|
|||
/// --max-columns-preview-before |
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.
Maybe a better name?
@@ -65,6 +65,7 @@ pub(crate) struct HiArgs { | |||
line_number: bool, | |||
max_columns: Option<u64>, | |||
max_columns_preview: bool, | |||
max_columns_preview_before: Option<u64>, |
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.
We can combine this to max_columns_preview: Option<u64>
, but will cause breaking changes. Is this acceptable?
@@ -5335,6 +5384,42 @@ fn test_pcre2_version() { | |||
assert_eq!(Some(SpecialMode::VersionPCRE2), args.special); | |||
} | |||
|
|||
/// --per-match |
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.
Expose this to cli.
self.write(b"[... omitted start of long line] ")?; | ||
line = line.with_start(start); | ||
} | ||
} |
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.
Compare to the full --column-context-before
+ --column-context-after
support that needs to modify everywhere, the implementation code here is quiet simple.
Hi, @BurntSushi , what is your opinion about this design? Many people work on JavaScript bundler and web reverse engineering rely on this feature because we needs to deal with very long line and many huge files. It's fine if you don't like this. I will still maintenance this patch for my friends. |
Dunno. I haven't reviewed this yet. I find the flag name long and overall unwieldy to use IMO. And I'm immediately skeptical of exposing I don't have any timeline on when I'll review this, sorry. To be clear, I'm open to adding some kind of feature for this functionality. |
See #1352 .