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 corrected command not being saved into fish history #1028

Closed
wants to merge 3 commits into from
Closed

Fix corrected command not being saved into fish history #1028

wants to merge 3 commits into from

Conversation

djh82
Copy link
Contributor

@djh82 djh82 commented Dec 19, 2019

This should fix #1027

@djh82 djh82 changed the title Fix corrected command not being saved into history Fix corrected command not being saved into fish history Dec 19, 2019
@nvbn
Copy link
Owner

nvbn commented Jan 5, 2020

Changes look good for me, but it seems like it breaks e2e tests - https://travis-ci.org/nvbn/thefuck/jobs/630646284#L3756

@djh82
Copy link
Contributor Author

djh82 commented Jan 5, 2020

Yes, I need to get round to fixing those. Having trouble running the end to end tests locally atm.

Copy link
Collaborator

@scorphus scorphus left a comment

Choose a reason for hiding this comment

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

That missing \n is the reason those integration tests are failing.

As far as the issue is concerned, I am not entirely sure yet whether this is the best way to solve it. It does not go very well with some usage scenarios such as post_match rules and a new edit command feature I've been working on.

thefuck/shells/fish.py Outdated Show resolved Hide resolved
@djh82
Copy link
Contributor Author

djh82 commented Jan 6, 2020

@scorphus happy for you to suggest further changes; or reject this entirely if it doesn't fit with your future changes. This is what I'm currently using at work, since the currently implemented method for updating the fish history simply doesn't work, and it's a bit frustrating, so thought I'd share!

@djh82 djh82 requested a review from scorphus February 10, 2020 18:23
@scorphus
Copy link
Collaborator

Let me have a look at this again.

@scorphus
Copy link
Collaborator

So, there are two reasons I think we should avoid changing the shell function. The main one is backward compatibility. A considerable number of users have the function hardcoded either in their config.fish or in some functions/fuck.fish. I've seen a lot of cases like that. Even some issues have that as a suggestion to improve the loading time of the shell.

Another reason is that it does not support a new feature I'm bringing together, which is the “edit command.” For that, I'd like to avoid having the commandline instruction added to the history.

That said, I think the commandline part of this PR should be moved into shell. I already have a working CL, which I'll submit shortly afterward as a new commit on top of yours. Then, you can review it.

Sounds good?

@djh82
Copy link
Contributor Author

djh82 commented Feb 11, 2020

Sounds good to me! 👍

@scorphus
Copy link
Collaborator

scorphus commented Feb 12, 2020

Hey, @davidhart82! I went ahead – as we usually squash commits by the same author that represent one single, “atomic” change – and squashed the two commits you had. So, authorship is preserved.

I'm looking forward to reading your thoughts on my proposed changes.

Thanks!

@djh82
Copy link
Contributor Author

djh82 commented Feb 24, 2020

Hey @scorphus, changes look good to me! Much neater given I had no idea folk hardcode the function directly in config.fish (I'm clearly spoiled with the power of my workstation ;)).

I'll give it a test and let you know how I get on...

@djh82
Copy link
Contributor Author

djh82 commented Apr 9, 2020

This only appears to have failed since the coverage has dropped by 0.01%...

Though, having tested this, although it works, it still stores the call to 'fuck' in the history. I wonder whether we want to search and delete those too?

@scorphus
Copy link
Collaborator

Looking good! I'll have time to review it over the weekend. Super!

@scorphus scorphus added this to the 3.31 milestone May 9, 2020
@scorphus scorphus self-assigned this May 10, 2020
@tonytamps
Copy link

Sorry to be the thread necromancer. Wondering if there is a reason 3.31 was never released?
There are a couple things I've been waiting a long while for and this one I've been desperate for since the issue was raised.

@scorphus
Copy link
Collaborator

Thanks for the reminder, @tonytamps! There're a few more issues/PRs that need to be solved/merged. All of the issues are already WIP. We're getting there!

@tonytamps
Copy link

All good. Thank you.

@scorphus
Copy link
Collaborator

BTW, I'm not entirely happy with how we managed to solve this issue, I guess I'll try some other approach(es).

@scorphus scorphus modified the milestones: 3.32, 3.33 Aug 2, 2021
@mainrs
Copy link

mainrs commented Dec 30, 2021

Is there anything that can be done to push this forward? The issue is still present. I've read the diff but I am not sure what the exact problem was.

@septatrix
Copy link

I am not sure since when this issue exists but it also occured to me that fish complaints because the history merge command does not take any arguments so I would be very glad if this could be merged soon as it looks like a good fix to me

@scorphus
Copy link
Collaborator

scorphus commented Jan 2, 2022

@septatrix: that issue (#1215) is fixed and released in 3.32. This PR addresses another issue.

@djh82 djh82 closed this Sep 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fish shell does not appear to have its history rewritten
6 participants