readline icon indicating copy to clipboard operation
readline copied to clipboard

Move history save after history init

Open miles-to-go opened this issue 11 months ago • 0 comments

This PR fixes an issue I encountered when re-executing commands from the history. Specifically, when I executed a previous command and then viewed the history immediately afterward, the history entry immediately after the executed command was blank. After doing some digging, the missing entry was still in the actual history, but the empty string was being saved in the undo history, causing it to appear as blank.

To fix this, I moved the history save in the init() function to after history's init. Alternatively, the save could be deleted, but I am not sure which is preferred.

To recreate this bug yourself, you can execute the following with the console example application:

cmd1<Enter>
cmd2<Enter>
cmd3<Enter>
cmd4<Enter>
<Up>
<Up>
<Up>
<Enter> (Execute cmd2 from the history)
<Up>
<Up>
<Up> (Now you will see cmd3 is missing)

miles-to-go avatar Mar 20 '24 11:03 miles-to-go