-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Support for line range minus syntax #1901
Conversation
Could you please explain to us if the syntax is only similar or exactly the same? Might make sense to adopt what |
It's similar -
|
assert_eq!(1, range.lower); | ||
assert_eq!(5, range.upper); | ||
let range = LineRange::from("5:-5").expect("Shouldn't fail on test!"); | ||
assert_eq!(0, range.lower); |
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.
Wait. Shouldn't that be 1
? Is 0
a valid line number?
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.
Turns out it is.
Try running bat -r 0:5 [some_file]
and bat -r 1:5 [some_file]
- both commands produce the same output
Thank you for the updates! Could you please add an entry to the "unreleased" section in
where |
@sharkdp updated. I also merged latest master. |
Continuation from #1810
In case we are working with a long file and we are interested in line
55478
, currently we could use55478:+5
to quickly see 5 lines after55478
.We might be interested to see a few lines preceding line
55478
, and with this change we could do it with55478:-5
or55478:-30
This is influenced by similar syntax in
git
forlog
sub-command with-L
argument.