Skip to content

Commit 80aee19

Browse files
authored
fix: tail_file return the first n lines, not last n lines
`newline_positions` is already in reverse order
1 parent 7cacb3c commit 80aee19

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/fs_service/io/read.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl FileSystemService {
116116
let start_pos = if line_count <= n {
117117
0 // Read from start if fewer than n lines
118118
} else {
119-
*newline_positions.get(line_count - n).unwrap_or(&0) + 1
119+
*newline_positions.get(n).unwrap_or(&0) + 1
120120
};
121121

122122
// Read forward from start_pos

0 commit comments

Comments
 (0)