GithubHelp home page GithubHelp logo

Comments (2)

Spakman avatar Spakman commented on August 17, 2024

Oops! I posted a wrong test program (in trying to reduce it as much as possible, I removed important characters). The colours should have been bounded by \001s and \002s. There is still a problem where the prompt is screwed as in the example above and I will try to distil and example of it later.

However, even with the correct escape sequence there is a problem:

require 'rb-readline'

cyan = "\001\e[0;36m\002"
reset = "\001\e[0m\002"
prompt = "#{cyan}screwy#{reset} % "

loop do
  Readline.readline(prompt, true)
end

This:

hello<Enter>
[Ctrl-r]hel[Right-arrow]

Produces:

% ruby --version
ruby 1.9.2p180 (2011-02-18) [x86_64-linux]
% ruby -I lib/ examples/issue-53
screwy % hello
screwy % hello
 ^---   cursor is incorrectly here

This works fine with Ruby 1.8.

from rb-readline.

Spakman avatar Spakman commented on August 17, 2024

This still happens on 1.9.3:

% ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

from rb-readline.

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.