Open zkry opened 7 months ago
Thanks for the feedback and reporting issues. Glad you find it useful!
If chatgpt-shell-prompt-compose is called with a prefix, it sends the "clear" command after the previously existing text, which ends up sending a malformed message.
Sounds like a bug (sending a malformed message), though the prefix clearing the shell history (by sending clear) is indeed intended as a way to change the topic (by dropping previous topic/history). I'll have a look into the malformed message.
If chatgpt-shell-prompt-compose is called without a prefix, things end up working, but maybe it would be more useful if the existing prompt text got copied into the compose buffer.
It kinda works like that at the moment, but maybe worth clarifying... the compose buffer is usually in either of two states:
Read-write
When in 1. the user is still composing a query. Further chatgpt-shell-prompt-compose
invokations with a selected region from another buffer, prepend the region to compose buffer.
If I'm understanding correctly, the feature request is to do the same but without selected region. I can add this soon.
Read-only
Query has already been send. Always clear buffer (but not history, unless with prefix).
That makes sense how it works. With the second point, I think how it is now is good actually. I think the only case where it could be improved is when the compose buffer is first created. It could do the following steps:
chatgpt-shell-prompt-compose
for the first timeThis would be useful in the case where a user starts to type into the CLI, but then changes their mind and decides they want to use the compose buffer.
Hi!
I really like the new compose interface and find it helpful! I noticed a few edge cases when a prompt already exists:
chatgpt-shell-prompt-compose
is called with a prefix, it sends the "clear" command after the previously existing text, which ends up sending a malformed message.chatgpt-shell-prompt-compose
is called without a prefix, things end up working, but maybe it would be more useful if the existing prompt text got copied into the compose buffer.I'd be happy to provide a MR for this. So my idea is that it would go something like this:
When
chatgpt-shell-prompt-compose
is called, check for existing prompt text and save it. If the prefix was sent, then erase the existing prompt, then send the "clear" command. Next, when creating the compose buffer, insert the pre-existing prompt text. Finally when compose is sent via C-c C-c, first clear the existing prompt text, then send the prompt from the compose buffer.