fix: tail -n counts lines correctly when input lacks trailing newline (fixes #1787)#1823
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|



Summary
PosixCommands.tailwhere-n Nreturned one extra line when input doesn't end with a newline character\n) rather than lines, so the final unterminated line wasn't counted, causing the window to include one extra lineFixes #1787
Summary by CodeRabbit
tailcommand to properly handle files without trailing newlines. Previously, when displaying the last N lines of a file that doesn't end with a newline, the final line could be incorrectly excluded from the output. The command now correctly counts and displays all lines.