hanslub42 / rlwrap

A readline wrapper
GNU General Public License v2.0
2.59k stars 151 forks source link

Save to history immediately after input is entered #152

Closed DUOLabs333 closed 2 years ago

DUOLabs333 commented 2 years ago

Currently, it seems that rlwrap only saves an input to file if the program is exited properly (ie, not with Ctrl+D). However, if you do Ctrl+D, history is not saved.

hanslub42 commented 2 years ago

rlwrap always saves its history whenever it exits, irrespective of the cause of the exit, which may be the rlwrapped program exiting, seeing a CTRL+D of getting a signal (except SIGKILL, of course) that causes it to exit

if you do Ctrl+D, history is not saved.

On my machine, it is, which means that I cannot reproduce the problem

Can you give a little more information: what command are you rlwrapping, what input are you entering, etc.

NB: from the title of this issue I expected a different request: that rlwrap should have an option to always immediately update the history file after each input line, rather like the zsh option INC_APPEND_HISTORY

This is indeed something to look into, but not needed to solve your issue.

DUOLabs333 commented 2 years ago

NB: from the title of this issue I expected a different request: that rlwrap should have an option to always immediately update the history file after each input line, rather like the zsh option INC_APPEND_HISTORY

This is exactly what I'm asking for. I am using rmaxima, which is basically rlwrap maxima.

hanslub42 commented 2 years ago

This is exactly what I'm asking for

OK, this is doable and may be useful in some situations. I'll mark this as a feature request

But you also mentioned:

However, if you do Ctrl+D, history is not saved.

This would be an rlwrap bug. Can you elaborate?

DUOLabs333 commented 2 years ago

I enter in some maxima expression and press enter. If I press Ctrl+D, then restart it, the input is not saved. It's only when I enter in the line and type in quit(); that it is saved.

hanslub42 commented 2 years ago

I cannot reproduce the problem. Maybe the maxima people can help?

DUOLabs333 commented 2 years ago

I'm on maxima 5.44.0

hanslub42 commented 2 years ago

In this kind of cases (i.e. a bug I cannot reproduce), please:

DUOLabs333 commented 2 years ago

It seems to be specific to Konsole, as xterm works fine.

DUOLabs333 commented 2 years ago

Found the problem -- it was an user error.