-
-
Notifications
You must be signed in to change notification settings - Fork 308
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
Add a way to disable indentation of multi-line commands #1834
Comments
Spent a bit of time looking into this while I'm rewriting the TUI. It's relatively easy to add an API for disabling indentation. But there's a more tricky issue - Elvish also manages line breaks itself instead of using the terminal's own soft line breaks. This means that in the example above:
The line breaks at the end of each line is actually a hard line break; so even if we get rid of the indentation, you still have those line breaks to deal with. Preserving soft line breaks is not exactly straightforward, especially in shells with more interactive features. Zsh seems to get this wrong: on my macOS machine using iTerm 2 with zsh 5.9 (arm64-apple-darwin24.0), if I type a long single-line command that spans multiple lines and then copy the command line, I get hard line breaks in between. Bash and Fish do get this correct, to their credits. It's definitely still possible, but probably not something I'll work on at the moment. On the other hand, I thought that the following workaround should work: # Run this in a mini-buffer, or in a keybinding:
edit:notify $edit:current-command This does get rid of the indentation, but unfortunately it still doesn't get rid of the hard line breaks. I'll push a fix that makes this workaround work soon, though. |
This allows a workaround for #1834. This change is quite big because it changes the representation of the notification from a term.Buffer to a ui.Text, which necessitates more downstream changes.
What new feature should Elvish have?
The editor currently indents multi-line such that they're all aligned with the end of the prompt, like this:
This is visually pleasing, but makes it inconvenient to copy-paste the command (or parts of it) since a lot of whitespace will be introduced. It would be nice to have an option to enable/disable this behavior, as in my opinion the indentation is not worth the copying troubles.
For info, other shells don't seem to do this kind of indentation.
Output of "elvish -version"
0.20.0-dev.0.20230826021805-1c0cffbfed89
Code of Conduct
The text was updated successfully, but these errors were encountered: