Code Monkey home page Code Monkey logo

Comments (10)

botherder avatar botherder commented on July 30, 2024

Yes I have the same problem. Frankly I don't know how to fix it tho.

from viper.

teskje avatar teskje commented on July 30, 2024

I think I found a solution. The bug is documented here: http://bugs.python.org/issue17337
There is a link to a possible fix: https://stackoverflow.com/questions/9468435/look-how-to-fix-column-calculation-in-python-readline-if-use-color-prompt

So, if in viper/common/colors.py the color is returned as:

return "\x01\x1b[%dm\x02%s\x01\x1b[0m\x02" % (color_code, text)

The linebreaking works. Unfortunately, if you output colors that way without using readline, it will print bogus chars. My quick and dirty fix was to add a default argument escape=False to the color functions and set this only to true when building the prompt. Its not really beautiful. Surely you can think of something better ;)

from viper.

kevthehermit avatar kevthehermit commented on July 30, 2024

Just changing the return line works for me. didnt set escape= anywhere. and have yet to see bogus chars.

Ubuntu 14.04 x64 server via putty0.63

Although Scrolling through the history now removes the prompt

from viper.

botherder avatar botherder commented on July 30, 2024

Please let me know which one is the best solution you guys encounter so that we can fix it.
If we need to tradeoff between things, we might even decide to get rid of the colors in the prompt (although that would be sad).

from viper.

teskje avatar teskje commented on July 30, 2024

Maybe the broken output happens only with zsh. I will test this and provide screenshots when I get around to it. Might take some days, though.

from viper.

botherder avatar botherder commented on July 30, 2024

No, happens with bash as well.

from viper.

teskje avatar teskje commented on July 30, 2024

Indeed it does.
Bogus chars with zsh:
2014-09-02--1409684004_670x225_scrot
And with bash:
2014-09-02--1409684075_628x227_scrot

My system is an up-to-data Arch Linux with Openbox. I also tested multiple terminal emulators, all have the same problem.

Note that there seem to be no problems with the conditional solution I proposed above, other than that it might not be the most elegant one.

from viper.

kevthehermit avatar kevthehermit commented on July 30, 2024

if it works commit :)

from viper.

teskje avatar teskje commented on July 30, 2024

I created a pull request: #129
It's my first, so bear with me if I did something wrong ;)

from viper.

kevthehermit avatar kevthehermit commented on July 30, 2024

think this can be closed now

from viper.

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.