lune icon indicating copy to clipboard operation
lune copied to clipboard

[BUG]: SIGINT during an stdio.prompt selection list hides terminal cursor

Open TreehouseFalcon opened this issue 1 year ago • 6 comments

When pressing Control-C on either Git Bash or Windows 11 terminal during a select or multiselect prompt via stdio.prompt, the terminal's cursor is hidden. This persists even through clears and requires you to start up a new terminal window.

TreehouseFalcon avatar Dec 07 '23 23:12 TreehouseFalcon

I cannot reproduce this on the Windows Terminal (which is what I assume you are referring to as Windows 11 terminal). Haven't tested on Git Bash/CYGWin/MinGW terminals though.

CompeyDev avatar Jan 05 '24 11:01 CompeyDev

This bug happens on both Git Bash and the default Windows terminal program/command prompt.

TreehouseFalcon avatar Feb 19 '24 22:02 TreehouseFalcon

This bug happens on both Git Bash and the default Windows terminal program/command prompt.

Any specific reproducible code in that case? Like I said, I've tried some code which would allegedly cause this, but with no luck.

CompeyDev avatar Feb 20 '24 08:02 CompeyDev

local stdio = require("@lune/stdio")
stdio.prompt("confirm", `Please confirm`)

This seems to reproduce the issue with 100% consistency. I'm on both an unmodified Windows command prompt shell and Git Bash running MINGW64.

TreehouseFalcon avatar Feb 20 '24 18:02 TreehouseFalcon

Will check it out later today, although it could likely be an issue with the upstream library we use for prompts, dialoguer.

CompeyDev avatar Feb 21 '24 15:02 CompeyDev

I was able to recently reproduce this! For some reason, dialoguer does not handle graceful exits via SIGINT and does not send the required ANSI sequence to make the cursor visible. There's not much of a workaround other than manually emitting a show cursor ANSI sequence after your lune command, unfortunately.

Issue https://github.com/console-rs/dialoguer/issues/294 is relevant, and the workaround on lune's end would be to manually handle emitting the ANSI sequence upon SIGINT.

CompeyDev avatar Dec 24 '24 08:12 CompeyDev