aiconfig
aiconfig copied to clipboard
[editor] Ctrl+Z does not return the prompts - input however returns the outputs - data
Proposed Solution:
When the user presses Ctrl+Z, the editor should undo the last action, including both the input and output, to restore the previous state compared to solely the output as it is right now. This behavior would be consistent with the interface, where Ctrl+Z typically undoes the last text entry or command. By restoring the input as well, users can easily revert to a previous state for their prompt input.
Expected Behavior:
- User inputs a command or text in the editor.
- User presses Ctrl+Z.
- The editor undoes the last action, including both the input and output.
- The editor returns to the state before the last action, showing the previous input prompt and removing the output data.
- The user can continue working from the restored state, with the option to redo the undone action if needed.
Current Behavior:
- User inputs a command or text in the editor.
- The user presses Ctrl+Z when clicking on the input box.
- The editor undoes the last action, which is solely the previous output.
@vanshb03 thanks a lot for reporting, and for your suggestion. @rholinshead what do you think about this? We are currently doing undo/redo just based on the state that is propagated to the TextDocument
Hmm, @vanshb03 may I ask which version of the extension you are using? Undo/redo was added a little while ago and should include undo/redo on the prompt inputs. Here's what I experience, for reference (on lastest extension version v0.0.21
):
https://github.com/lastmile-ai/aiconfig/assets/5060851/5d6b22bd-57b0-4cab-adc8-a4558f920772
If we can rule out the version as a potential cause of the issue, we can debug further to see what might be happening on your end to not have it working as expected.
So to recreate the issue, you have to click in the box before you Ctrl+Z, that is when the output box is the only one that changes and the input box remains the same as shown on the issue.
@rholinshead @saqadri
With clicking the input box I'm still able to get the input to be undone
https://github.com/lastmile-ai/aiconfig/assets/5060851/431af779-e973-420d-ab49-7abb31fe3cf0
But, maybe I misunderstood the expected behaviour? For context, the series of events that happens when updating the input and running is: (update input) -> (run, clear existing input) -> (run, update output). When I Ctrl+Z I can see these events being undone in reverse.
In your experience, is that not the case? Or are you instead proposing that Ctrl+Z in this case should undo the three events together as one step?
If the latter, there is a complication with doing so. It's possible that there could be some other unrelated event between (update input) and (run) for that input (e.g. adding another cell), or it's possible that there are a series of (update input) events before running -- this is actually the case, as you type with short pauses -- which would then need some heuristic to understand how many updates to undo.
Or, alternatively if you are proposing that Ctrl+Z should only undo the input and NOT the output, then that does resonate, since that's the behaviour in colab/jupyter for notebooks. If this is the case, the good news is I believe this will naturally happen as a result of some future updates to aiconfig.
Yes, I was proposing that Ctrl+Z would only undo the input and not the output solely as it is currently.