ask.sh icon indicating copy to clipboard operation
ask.sh copied to clipboard

The output lines are excessively removed when choosing not to execute the command

Open matsurih opened this issue 1 year ago • 2 comments

Environment: Ubuntu 24.04 / zsh + tmux

When I ask something:

$ ask create empty file
- To create an empty file, you can use `touch` command followed by the desired filename:
```
touch filename.txt
```
👋 Hey, AI has suggested some commands that can be typed into your terminal.
🔍 Press Enter to view and select the commands, or type any other key to exit:[[cursor]]

After type some key (not Enter):

$ ask create empty file
- To create an empty file, you can use `touch` command followed by the desired filename:
```
$ [[cursor]]

I think below is correct:

$ ask create empty file
- To create an empty file, you can use `touch` command followed by the desired filename:
```
touch filename.txt
```
$ [[cursor]]

Upon looking at print_init_script() in main.rs, it seems that cursor moves up 3 lines and after that 4 lines are being deleted, but since only 2 lines (starts with 👋 and 🔍) are actually unnecessary, the last 2 lines of the LLM's output are also being removed.

There may be differences depending on the terminal environment and whether the LLM's output ends with \n, but in any case, shouldn't only two lines that were added later be removed?

(After I fix the init script as a test, the output upon cancellation seems to be corrected, but instead, the behavior when using peco became problematic. Since I'm not very familiar with peco, I've decided not to create a PR for now...)

matsurih avatar Aug 16 '24 06:08 matsurih

Seconding this behavior.

I found that you can get around the output deletion by hitting the "Enter" key to see the list of AI suggestions and then hitting Esc. The deletion doesn't happen then.

If you type any key instead of viewing the AI suggestions list, then the deletion happens.

pha3z avatar Oct 06 '24 03:10 pha3z

Thank you for the report. I'll look into this.

hmirin avatar Oct 08 '24 13:10 hmirin

Fixed! If the problem persists, please reopen this issue!

hmirin avatar Feb 04 '25 03:02 hmirin