Skip to content

Add btn support for N=0 (disable newline insertion)#59

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/add-btn-no-newline-argument
Draft

Add btn support for N=0 (disable newline insertion)#59
Copilot wants to merge 3 commits into
mainfrom
copilot/add-btn-no-newline-argument

Conversation

Copy link
Copy Markdown

Copilot AI commented May 20, 2026

btn currently requires N in [1, 32] and always inserts line breaks. This change extends the contract to allow N=0, which preserves whitespace stripping while disabling newline insertion entirely.

  • Behavior update (N=0)

    • Updated C, Python, and Haskell implementations of btn to accept 0 as a valid argument.
    • N>0 behavior remains unchanged (chunked output with trailing newline handling).
    • N=0 now emits a single condensed stream with no inserted \n.
  • Argument range and spec alignment

    • Updated range handling from [1, 32] to [0, 32] in btn docs/spec.
    • Clarified conditional newline rules in the specification for N>0 vs N=0.
  • Targeted test coverage

    • Added a no-newline test case to test/.test/btn.test using argument 0.
    • Expected output validates fully condensed text with no trailing newline.
/* C behavior change */
if (num_char_until_newline > 0 &&
      printed_char_count == num_char_until_newline) {
   putchar('\n');
   printed_char_count = 0;
}
...
if (num_char_until_newline > 0 && printed_char_count != 0)
   putchar('\n');

Copilot AI linked an issue May 20, 2026 that may be closed by this pull request
@lshqqytiger
Copy link
Copy Markdown
Contributor

실험용

Copilot AI and others added 2 commits May 20, 2026 12:16
Agent-Logs-Url: https://github.com/sdbx/Utils/sessions/9c192315-782b-4eca-ad36-d4a923134398

Co-authored-by: lshqqytiger <39524005+lshqqytiger@users.noreply.github.com>
Agent-Logs-Url: https://github.com/sdbx/Utils/sessions/9c192315-782b-4eca-ad36-d4a923134398

Co-authored-by: lshqqytiger <39524005+lshqqytiger@users.noreply.github.com>
Copilot AI changed the title [WIP] Add no newline option for btn function Add btn support for N=0 (disable newline insertion) May 20, 2026
Copilot AI requested a review from lshqqytiger May 20, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Request] btn without newline

2 participants