tty-prompt
tty-prompt copied to clipboard
Move hardware cursor to selection in select/multi_select
The hardware cursor is not moved to the focussed option in select and multi_select, which causes problems in software such as terminal screenreaders for the blind.
require 'tty'
p=TTY::Prompt.new
p.select("Choice?", %w(First Second Third))
Hey Guillem,
Thank you for using this lib! I'd definitely like to fix the situation. I think this is due to the fact that I'm using escape codes to actually hide the cursor and replace it with visual arrows etc... I will see if I can provide an option to allow to toggle this behaviour. I will need your help with testing if possible.
Hello, Thanks a lot. I'll be happy to test any changes as needed. Yes; the only way to make sure this works that I know of is actually using the cursor.
Sent from my iPhone
On 19 Jul 2017, at 12:38 AM, Piotr Murach [email protected] wrote:
Hey Guillem,
Thank you for using this lib! I'd definitely like to fix the situation. I think this is due to the fact that I'm using escape codes to actually hide the cursor and replace it with visual arrows etc... I will see if I can provide an option to allow to toggle this behaviour. I will need your help with testing if possible.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
I had a bit more in depth look at this issue and there isn't an easy fix. The whole logic for painting these menus relies on moving the cursor relative to its current position which always ends up being the last painted string regardless of the currently marked option. I'm not saying I won't work on it but it is far more convoluted than I've expected. Please bear with me.
Till now this issue was not fixed. I don't know what to do about this problem.
I figured out that this happens when I use bash in VS Code. In Windows CMD it is working fine as well in Cmder.
@lflucasferreira I hope you don't mind me asking but are you visually impaired? Is this issue affecting your use of assistive technology such as terminal screen readers as discussed in this issue? Is that why you're frustrated? As I explained in the previous answer the 'fix' would require a significant update for which I'm struggling to find the time. Do you have time to help?