-
-
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
ls: fix issue #6697 (different "ls -lF --dired" from GNU) #6699
base: main
Are you sure you want to change the base?
Conversation
Can you please run |
could you please add a test to make sure we don't regress ? |
Yes, added. Is this ok? |
yes, sorry, i missed your comment :) |
src/uu/ls/src/dired.rs
Outdated
let end = start + dfl_len; | ||
let end_filename = start + dfn_len; |
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.
for a different pr but we should rename dfl & dfn for something more explicit
@@ -195,29 +207,60 @@ mod tests { | |||
fn test_calculate_dired() { |
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.
please add a new tests which shows when end and end_filename are different ?
@@ -42,7 +42,9 @@ use uucore::error::UResult; | |||
#[derive(Debug, Clone, PartialEq)] | |||
pub struct BytePosition { |
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.
it is not a big deal because --dired isn't used a lot but we are storing extra data every time even this case happens rarely
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.
I know this solution might be a bit silly, but I'm not good at programming.
It seems like 'end_line' is only used to calculate the offset for the next line, so it should be fine to just store 'end_filename' maybe.
I'll try to optimize it. :)
And apologies for my messy coding style; it might be difficult to review. 😢 |
Please let me know if there are any wrong. I'm not familiar with Rust.
Fix #6697