thefuck icon indicating copy to clipboard operation
thefuck copied to clipboard

Fix corrected command not being saved into fish history

Open djh82 opened this issue 5 years ago • 17 comments

This should fix #1027

djh82 avatar Dec 19 '19 13:12 djh82

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

nvbn avatar Jan 05 '20 21:01 nvbn

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

djh82 avatar Jan 05 '20 21:01 djh82

@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 avatar Jan 06 '20 12:01 djh82

Let me have a look at this again.

scorphus avatar Feb 11 '20 09:02 scorphus

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?

scorphus avatar Feb 11 '20 10:02 scorphus

Sounds good to me! 👍

djh82 avatar Feb 11 '20 12:02 djh82

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!

scorphus avatar Feb 12 '20 09:02 scorphus

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 avatar Feb 24 '20 11:02 djh82

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?

djh82 avatar Apr 09 '20 10:04 djh82

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

scorphus avatar Apr 17 '20 18:04 scorphus

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.

tonytamps avatar Jan 31 '21 20:01 tonytamps

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!

scorphus avatar Jan 31 '21 21:01 scorphus

All good. Thank you.

tonytamps avatar Jan 31 '21 21:01 tonytamps

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

scorphus avatar Jan 31 '21 22:01 scorphus

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.

mainrs avatar Dec 30 '21 12:12 mainrs

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

septatrix avatar Jan 02 '22 16:01 septatrix

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

scorphus avatar Jan 02 '22 22:01 scorphus