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

Selecting previous command forgets trailing escaped space #7661

Closed
Shizcow opened this issue Jan 28, 2021 · 4 comments
Closed

Selecting previous command forgets trailing escaped space #7661

Shizcow opened this issue Jan 28, 2021 · 4 comments
Labels
bug Something that's not working as intended good first issue
Milestone

Comments

@Shizcow
Copy link
Contributor

Shizcow commented Jan 28, 2021

Problem and Reproduction

Take the following command (where there is a space after \, making it escaped)

echo \ 

The command will execute properly. However, when pressing up to re-use the previous command, the trailing space is removed. While removing trailing spaces is usually a good idea, I don't think this should be the case when the last space is escaped.

As this seems like a pretty simple fix, I'd be happy to try my hand at fixing -- assuming this is indeed a bug and someone doesn't beat me to it!

System Info

Fish version: 3.1.2
OS: Arch Linux
Present when customizations are disabled

@krobelus
Copy link
Member

Yeah, looks like a bug. The space trimming is historical behavior. I think we could exercise a tokenizer_t here to tell real spaces from escaped ones.

@krobelus krobelus added the bug Something that's not working as intended label Jan 28, 2021
@krobelus krobelus added this to the fish-future milestone Jan 28, 2021
@ridiculousfish
Copy link
Member

@Shizcow yeah seems like it should be a straightforward fix, if you know a little C++. krobelus showed the source location, you could enhance that to only trim spaces that have zero preceding \ (or have an even number).

@Shizcow
Copy link
Contributor Author

Shizcow commented Jan 30, 2021

Yeah, just had some schoolwork to finish before I could put any time towards anything else. Everything should be in order now.

@ridiculousfish
Copy link
Member

Merged the PR as cff5aa9, thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something that's not working as intended good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants