X-Git-Url: https://vcs.fsf.org/?p=rainbowstream.git;a=blobdiff_plain;f=rainbowstream%2Fcolors.py;h=a39dcb6b0c41ac9d78e1495c27e92bf4cda17d56;hp=335847f620389b0863fe31357155a9a9572fe1f2;hb=4efb38a4b5c7340a07a3e2d31f64a246b644fe40;hpb=be4dba0eaa164b49f37930e9fa41e240cd36f06c diff --git a/rainbowstream/colors.py b/rainbowstream/colors.py index 335847f..a39dcb6 100644 --- a/rainbowstream/colors.py +++ b/rainbowstream/colors.py @@ -3,6 +3,10 @@ def basic_color(code): 16 colors supported """ def inner(text, rl=False): + """ + Every raw_input with color sequences should be called with + rl=True to avoid readline messed up the length calculation + """ c = code if rl: return "\001\033[%sm\002%s\001\033[0m\002" % (c, text) @@ -16,6 +20,10 @@ def term_color(code): 256 colors supported """ def inner(text, rl=False): + """ + Every raw_input with color sequences should be called with + rl=True to avoid readline messed up the length calculation + """ c = code if rl: return "\001\033[38;5;%sm\002%s\001\033[0m\002" % (c, text)