BuilderIO / ai-shell

A CLI that converts natural language to shell commands.
MIT License
4.04k stars 257 forks source link

429 error hijacks text cursor #46

Open xenostar opened 1 year ago

xenostar commented 1 year ago

I'm using iterm2, oh-my-zsh, and startship prompt.

When initially using this package, I was getting the 429 error. It seems as if the cursor disappears and won't come back after the failed prompt. Here is an example video:

https://user-images.githubusercontent.com/1480285/232142946-f489c931-d63b-45ed-83c6-c7d5acf1fae4.mov

AlaEddineBoughanmmi commented 1 year ago

does storing PS1 and then restoring it solves the problem? could you try this:

ORIGINAL_PS1=$PS1
ai list all log files 
export PS1=$ORIGINAL_PS1

do you have the cursor back?

Jordhan-Carvalho commented 1 year ago

does storing PS1 and then restoring it solves the problem? could you try this:

ORIGINAL_PS1=$PS1
ai list all log files 
export PS1=$ORIGINAL_PS1

do you have the cursor back?

Had the same issue and the above did not work

AlaEddineBoughanmmi commented 1 year ago

i'm using this command tput cnorm as way to restore the cursor.

and in the code calling it like this:

image

However, I believe there is a better approach to resolving the problem, and I am currently working on implementing a a more graceful error handling solution.