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

fix(enter_accept): clear old cmd snippet #1350

Merged
merged 1 commit into from
Oct 28, 2023
Merged

Conversation

arcuru
Copy link
Sponsor Contributor

@arcuru arcuru commented Oct 27, 2023

Followup for #1341 and #1342. This clears the prompt of any command snippet the user entered before opening the atuin history search.

Both prompts still have issues with how the fake command looks after we've run it. Bash overwrite the whole prompt line with the command (See #1342), and I wasn't able to figure out how to clear the pre-existing cmd snippet from fish.

For the fish problem, as an example if you type ech, then hit ctrl+r and select echo here it will appear like this:

$ echecho here
here

$ 

I'm not sure how solid these fixes actually are, both shell's will cause a bit of confusion for users but I think it's the best we can do at the moment 🤷

@vercel
Copy link

vercel bot commented Oct 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
atuin-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 27, 2023 9:50pm

Copy link
Member

@ellie ellie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

I'll try and iterate on this a bit but will consider disabling it by default for those shells. Very frustrating.

@ellie ellie merged commit 6b20f89 into atuinsh:main Oct 28, 2023
10 checks passed
@arcuru arcuru deleted the clear_cmd branch October 29, 2023 02:20
@arcuru
Copy link
Sponsor Contributor Author

arcuru commented Oct 29, 2023

If you're going to touch this yourself, I will say that I did try several different ways of fixing the fish problem. It appears that all the calls to commandline didn't take effect until after this function returned. They seemed to be queued up commands that fish would handle at the end.

So these 3 ways of fake replacing the original command didn't work

set hist (....)
commandline -r "$hist"
commandline -f repaint
set hist (....)
commandline -r ""
commandline -f repaint
echo $hist
set hist (....)
commandline --cursor 0 # <-- moves cursor to position 0
commandline -f repaint
echo $hist

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.

2 participants