Skip to content

repl: fix history truncation of long lines#15258

Open
amaanq wants to merge 1 commit intoNixOS:masterfrom
obsidiansystems:fix-repl-history
Open

repl: fix history truncation of long lines#15258
amaanq wants to merge 1 commit intoNixOS:masterfrom
obsidiansystems:fix-repl-history

Conversation

@amaanq
Copy link
Member

@amaanq amaanq commented Feb 16, 2026

Motivation

Editline's read_history uses fgets(buf, 256, fp) internally, splitting
any line longer than 255 characters into multiple history entries. This
commit bypasses it with std::getline and add_history calls, which
handle arbitrary lengths. GNU readline's read_history has no such limit
and is left as-is, and write_history already writes full lines via
fprintf so it needs no change either.

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@amaanq amaanq requested a review from edolstra as a code owner February 16, 2026 22:38
@amaanq amaanq force-pushed the fix-repl-history branch 4 times, most recently from 938adb3 to 0d5de78 Compare February 17, 2026 02:05
Editline's `read_history` uses `fgets(buf, 256, fp)` internally, splitting
any line longer than 255 characters into multiple history entries. This
commit bypasses it with `std::getline` and `add_history` calls, which
handle arbitrary lengths. GNU readline's `read_history` has no such limit
and is left as-is, and `write_history` already writes full lines via
`fprintf` so it needs no change either.
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.

nix repl splits long lines in repl-history

1 participant

Comments