Skip to content

Conversation

@bobrowadam
Copy link
Contributor

This will allow user to undo changes on the current prompt and context areas but not on any of the previous chat buffer
areas.

Addresses:
#64

@ericdallo
Copy link
Member

@bobrowadam thanks for the try, but still cause issues if one try to undo after chat has messages

@ericdallo
Copy link
Member

Also I felt in a case where I undo the context but it was still in there in the eca variables, so it was not visually there but was used which is dangerous

@bobrowadam
Copy link
Contributor Author

can you explain how? the undo would work only on the user current prompt, not previous chat messages. do you notice a different behavior?

@ericdallo
Copy link
Member

Send any hello message, wait until the LLM reply, than in prompt type u to undo, you will see it will undo the content LLM outputed

@bobrowadam bobrowadam force-pushed the prompt-undo branch 2 times, most recently from e34f9e6 to 242ee57 Compare October 25, 2025 20:34
@bobrowadam bobrowadam closed this Oct 26, 2025
@bobrowadam bobrowadam reopened this Oct 27, 2025
@bobrowadam
Copy link
Contributor Author

@ericdallo
I did some more changes that should handle all the edge cases, yet the code is not nice and adding more components that edit the chat buffer would probably break this.
It would be best if we only insert text using a dedicated function/macro that is always handling the undo state and not using insert directly, but this might be a considerably big refactor. WDYT?

@ericdallo
Copy link
Member

ericdallo commented Oct 27, 2025

@bobrowadam I like that, I'm ok with creating a eca-chat--insert for that, are you willing to do that?
Let's be as concise as possible in the changes though for the review

@bobrowadam
Copy link
Contributor Author

@bobrowadam I like that, I'm ok with creating a eca-chat--insert for that, are you willing to do that? Let's be as concise as possible in the changes though for the review

Yes. I'll give that a try

@ericdallo
Copy link
Member

ericdallo commented Oct 27, 2025

Hey @bobrowadam I just went ahead and followed with your idea, commenting in the issue, but feel free to change anything or test/fix if you find any problems, thanks for the help so far, I believe we could close this one and open a new one if needed

@ericdallo ericdallo closed this Oct 27, 2025
@bobrowadam
Copy link
Contributor Author

OH nice!
Found a small bug that I'm trying to fix:
If you insert some text in the prompt, then add context (for instance, moving the cursor), the undo history will be erased while you are still in the middle of editing your prompt.
Also, we are not handling delete-region, which we probably need to.

@ericdallo
Copy link
Member

Hum makes sense, I kinda replaced all inserts with our internal function, we would need to remove some of them and maybe rename to eca-chat--insert-cleaning-undo

@bobrowadam bobrowadam deleted the prompt-undo branch October 30, 2025 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants