Comments (10)
Can you share the output of the following?
$ ruby -r highline -ve 'p [HighLine::VERSION, HighLine::SystemExtensions::CHARACTER_MODE]'
from highline.
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
["1.6.15", "stty"]
Same behavior with 1.9.3p327, 1.8.7p371 (using rvm) and system ruby (1.9.3p0)
from highline.
Thanks. I'll try to look into this when I get a chance.
from highline.
Small update: I finally got termios
installed (I used the wrong gem and gave up too early), and as you probably already know, with termios
it works, the only difference between character = true
and character = :getc
is the newline in the former case, but there is no indentation.
from highline.
Yeah, termios
is preferred. Still, stty
should work better.
from highline.
fyi I was having trouble with gem install termios
and needed to do gem install ruby-termios
instead... see this SO answer for more details
from highline.
Hi! I'm hitting what I think is the same problem… with character = true
, I get indentation on the next puts
…
Code
require 'highline/import'
ask("question: ") { |q| q.character = true}
puts "text"
Output
❯ ./test.rb
question: y
text
❯ ruby -r highline -ve 'p [HighLine::VERSION, HighLine::SystemExtensions::CHARACTER_MODE]'
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
["1.7.2", "stty"]
I tried q.character = :getc
but then I needed to add a newline the the next print… is there a way to work around this?
from highline.
A quick (and dirty) way to work around the issue is to prepend "\r" to the next string.
require 'highline/import'
ask("question: ") { |q| q.character = true }
puts "\rtext"
I'll be looking forward to fix it to the "reasonable expected behaviour".
Thanks for reporting!
from highline.
@carlosefonseca I've just merged the workaround into 1-7-stable and into master
Please tell me if it worked for you.
When @JEG2 come back from vacation he'll make a gem release of them.
But you are already able to install them manually if you like.
I'll keep this issue open, as I'll review it later.
from highline.
The test above now works with the manual installation of highline! Thanks!
from highline.
Related Issues (20)
- Docs not on RubyDoc.info as README states HOT 2
- Proc validation displays ruby object on invalid HOT 8
- Incosistent behavior when ask with a validator and readline=true HOT 9
- undefined method 'default_instance' HOT 3
- Default Highline Example on GithubGives Error HOT 5
- HighLine Terminal::IOConsole#restore_mode does not work with StringIO HOT 3
- System extensions depend on now-internalized JRuby dependencies HOT 14
- consider exposing Readline.completion_proc via HighLine::Question#selection HOT 3
- default value has to be a string HOT 14
- Ctrl-C improperly handled when q.echo = false HOT 6
- Issues with echo: false and not on TTY HOT 7
- Can't get terminal_size HOT 11
- echo=false or echo='*' requires extra character after enter on Windows HOT 6
- Possible to accept multiple selections with `.in` and `.default`? HOT 5
- test failing when ruby is built against libedit instead of readline HOT 3
- Have to set convert type in order for `.in` to work with array
- 2.1.0 was released, but tag is missing in repository HOT 2
- Make Highline Ruby 3.3 and reline compatible HOT 1
- Update tests for Reline (as the substitute of Readline)
- Add `abbrev` to gemspec HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from highline.