Forum: Ruby Backspace Issue with Highline Gem

Posted by Khirod Patra (khirodjruby)
on 2012-09-26 12:29
Hi,

I am using highline gem for getting input from user. It works fine in
windows with backspace character , but it does not work same in linux. I
used the code i.e.

input=ask("Enter the Input: "){|ch| ch.echo = true}

In Linux environment when I used to press backspace , the output is
something like :

Enter the Input: 33cuttack

After pressing backspace to erase the inputed characters i.e.

Enter


So it removes some part of  message also Or some times the whole
message.

Please help me on this....


Let me know for any further information.


Thanks
Khirod Patra
Posted by Khirod Patra (khirodjruby)
on 2012-09-26 13:18
Khirod Patra wrote in post #1077610:
> Hi,
>
> I am using highline gem for getting input from user. It works fine in
> windows with backspace character , but it does not work same in linux. I
> used the code i.e.
>
> input=ask("Enter the Input: "){|ch| ch.echo = true}
>
> In Linux environment when I used to press backspace , the output is
> something like :
>
> Enter the Input: 33cuttack
>
> After pressing backspace to erase the inputed characters i.e.
>
> Enter
>
>
> So it removes some part of  message also Or some times the whole
> message.
>
> Please help me on this....
>
>
> Let me know for any further information.
>
>
> Thanks
> Khirod Patra




The above Issue has been resolved :
The code should used instead of the above one is

input=ask("Enter the Input: ") do |ch|
   ch.readline=true
end


Through above code It will work in both Windows and Linux. I have not 
tested it on AIX . Will update soon...

Thanks
Khirod Patra
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.