Repository navigation
fix(tail): preserve trailing newlines across unselected inputs - #1290
Open
sergioperezcheco wants to merge 1 commit into
Open
sergioperezcheco wants to merge 1 commit into
sergioperezcheco wants to merge 1 commit into
Conversation
Only let files contributing selected lines control the final newline. Cover empty and header-only trailing inputs and preserve selected blank lines. Assisted-by: OpenAI GPT-6.1 Signed-off-by: sergioperezcheco <checo520@outlook.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1290 +/- ##
=======================================
Coverage 97.17% 97.17%
=======================================
Files 36 36
Lines 1523 1524 +1
=======================================
+ Hits 1480 1481 +1
Misses 43 43 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a later input contributes no selected lines,
tail()still replaces the trailing-newline state from earlier inputs. For example,tail({'-n': '+2'}, ['data.csv', 'header-only.csv'])can remove the final newline from the selected data, or add one to otherwise unterminated output. Empty files also affect ordinary counts.Only update the newline state when an input contributes selected lines. This preserves real blank lines and the existing multi-file concatenation behavior, with regressions for array and separate arguments, both newline directions, and empty final files. The header-removal workflow discussed in #983 is existing functionality; this does not reopen or claim to fix that closed issue.
Validated independently on macOS with Node 22: the new regressions fail against the original implementation and pass with the change;
npm test, lint, coverage, generated-documentation checks, Node-support checks, and actual packed-package/public API checks pass. Linux/Windows and the other supported Node versions were not run locally.AI-assisted implementation and automated independent review; no human review is claimed.