Pressing up or down will delete edited history entries

Issue #1090 new
Ville Aakko created an issue

Hi,

If the user presses up or down, while the user is editing an entry, it is impossible to return to the edited version

This is especially annoying if the user is trying to enter some lengthy expression. One might often need to return to the expression (if it was mistyped; say, a function definition). It is very easy to press “up” by mistake, but if one does, the current entry will be gone!

How other software which have histories handle this might be varied, but it should not be as easy as it is now to lose changes.

This might (?) be easy to fix. Save the edited entry into a separate buffer similar to the new command (which is saved), and make a copy of this into history as the last entry, if/when enter is pressed (preserving old history). This is what some shells - for example, bash - seems to be doing. One can not revert to an old line in history if enter has not been pressed, but done this way, no history is ever “lost”. Old history is only “hidden” if it has been edited, but not yet entered as a new command.

Or, the history could be editable (and saved) even without pressing enter. This approach has the problem where the history might be edited by accident, and it will be gone immediately if the user does so. I suggest the approach in the previous paragraph (the way bash and most probably other software does it).

Steps to reproduce:

  1. Make sure there is something in history (type some commands into speedcrunch, if history is empty) .
  2. Press up to choose an old line in history
  3. Edit an old line (but don’t press enter)
  4. Press up or down again
  5. Press down or up again to get back to the entry which you’ve edited in step 3.

Expected results:

  • The entry should be displayed as it was edited

Actual results:

  • The entry in history has been reverted to as it was before editing

Comments (1)

  1. Log in to comment