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

Remember last command #101

Closed
cferrys opened this issue Feb 23, 2021 · 4 comments · Fixed by #105
Closed

Remember last command #101

cferrys opened this issue Feb 23, 2021 · 4 comments · Fixed by #105
Assignees
Labels
enhancement New feature or request

Comments

@cferrys
Copy link

cferrys commented Feb 23, 2021

Hello,

First of all, congrats on your project. I certainly like it! hope to see it thriving in the upcoming years.

I was wondering whether you could add a feature where our last command is remembered. Ideally, we could re-run our last commands with the up-arrow + enter.

I'm uncertain if this is something too complex to implement?

Would certainly love to see it in kirc.c!

Have a great week.

@mcpcpc mcpcpc self-assigned this Feb 24, 2021
@mcpcpc mcpcpc added the enhancement New feature or request label Feb 24, 2021
@mcpcpc
Copy link
Owner

mcpcpc commented Feb 24, 2021

absolutely! line history would definitely enhance the user experience. however, please see issue https://github.com/mcpcpc/kirc/issues/102 where i will be tracking closure of this issue.

@mcpcpc
Copy link
Owner

mcpcpc commented Mar 9, 2021

@cferrys: I somewhat gave up on the previously mentioned issue in favor of smaller incremental changes. With that said, I am have a somewhat working implementation of the history buffer: https://github.com/mcpcpc/kirc/tree/0.2.5

There are some issues i am still working to resolve (e.g. how the history buffer increments/decrements values), but there should be no memory leaks or set faults at the very least least =). You are welcome to play around with it while I work out the bugs and let me know your thoughts.

@cferrys
Copy link
Author

cferrys commented Mar 9, 2021

hey mcpcpc!

Thanks for notifying me about the update.

Yes, it does seem to be that you are on the right track. However, it does seem to be that we can only keep one command at the time in the history_index buffer. It also seems to be that you are having a bit of a problem storing the last char on the last command.

In C++, something like this would do the the trick.

    std::multimap<time_t, std::string> cmds;

whereas you can keep a track of commands and when it was inserted, then a timer or so could delete the cmds buffer if there are too many commands in history.

Overall I like the progress, keep the hard work and let me know if you have some free time to fix the last letter from the l->buf when storing.

Have a great week.

@mcpcpc
Copy link
Owner

mcpcpc commented Mar 17, 2021

Finally got around to debugging it. Try the latest commit to the 0.2.5 branch: c7f090e

@mcpcpc mcpcpc linked a pull request Mar 18, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants