diff --git a/src/fs_service/io/read.rs b/src/fs_service/io/read.rs index 575d5b9..45616e2 100644 --- a/src/fs_service/io/read.rs +++ b/src/fs_service/io/read.rs @@ -116,7 +116,7 @@ impl FileSystemService { let start_pos = if line_count <= n { 0 // Read from start if fewer than n lines } else { - *newline_positions.get(line_count - n).unwrap_or(&0) + 1 + *newline_positions.get(n).unwrap_or(&0) + 1 }; // Read forward from start_pos diff --git a/src/tools/tail_file.rs b/src/tools/tail_file.rs index bc40e55..f5816d7 100644 --- a/src/tools/tail_file.rs +++ b/src/tools/tail_file.rs @@ -24,7 +24,7 @@ use crate::fs_service::FileSystemService; pub struct TailFile { /// The path of the file to get information for. pub path: String, - /// The number of lines to read from the beginning of the file. + /// The number of lines to read from the ending of the file. pub lines: u64, }