Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repl: don't add trailing spaces to history lines #2336

Merged
merged 1 commit into from Aug 29, 2018
Merged

repl: don't add trailing spaces to history lines #2336

merged 1 commit into from Aug 29, 2018

Conversation

ivan
Copy link
Member

@ivan ivan commented Aug 7, 2018

This fixes #2314.

I tested this manually and confirmed that a trailing space is no longer present when hitting Up to get a previous line, and that multi-line input still works, and that ctrl-c and ctrl-d still work.

Sidenote: I had to revert 7de3e00 to build nix with nixpkgs master because the aws-sdk-cpp patch failed to apply.

@edolstra
Copy link
Member

Maybe it's better to do input = chomp(input); to ensure that all trailing whitespace is removed. (Or even use trim() to remove leading whitespace as well.)

@ivan
Copy link
Member Author

ivan commented Aug 29, 2018

I tried something like that first, but then I examined several other REPLs (Python, Elixir, zsh, bash), which all preserve user-entered whitespace. The preservation seemed to feel less surprising (e.g. when blindly pressing Backspace some number of times after Up), so I left it in.

@edolstra edolstra merged commit 1286d86 into NixOS:master Aug 29, 2018
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 leaves trailing space in history
2 participants