Giter Site home page Giter Site logo

Comments (10)

JEG2 avatar JEG2 commented on July 18, 2024

Can you share the output of the following?

$ ruby -r highline -ve 'p [HighLine::VERSION, HighLine::SystemExtensions::CHARACTER_MODE]'

from highline.

stomar avatar stomar commented on July 18, 2024
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.

JEG2 avatar JEG2 commented on July 18, 2024

Thanks. I'll try to look into this when I get a chance.

from highline.

stomar avatar stomar commented on July 18, 2024

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.

JEG2 avatar JEG2 commented on July 18, 2024

Yeah, termios is preferred. Still, stty should work better.

from highline.

alexch avatar alexch commented on July 18, 2024

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.

carlosefonseca avatar carlosefonseca commented on July 18, 2024

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.

abinoam avatar abinoam commented on July 18, 2024

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.

abinoam avatar abinoam commented on July 18, 2024

@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.

carlosefonseca avatar carlosefonseca commented on July 18, 2024

The test above now works with the manual installation of highline! Thanks!

from highline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.