[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [arm/release] Only doing the prompt padding hack when needed
commit 7769d33b56b124ee7fceba435a6040ef790b2dc9
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sun Sep 18 21:23:12 2011 -0700
Only doing the prompt padding hack when needed
The color prompt bug mentioned in 'http://bugs.python.org/issue12972' only
effects Python 2.6 and earlier so dropping the hack where I pad the prompt for
versions that don't need it.
---
src/util/torInterpretor.py | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/util/torInterpretor.py b/src/util/torInterpretor.py
index 7e96d3c..74559ba 100644
--- a/src/util/torInterpretor.py
+++ b/src/util/torInterpretor.py
@@ -5,6 +5,7 @@ directly, history and tab completion.
"""
import re
+import sys
import readline
import version
@@ -791,8 +792,8 @@ class ControlInterpretor:
return (inputLines, outputLines)
def prompt():
- # Cycling history via the readline module with up/down is buggy with a color
- # prompt. For more information see:
+ # For Python 2.6 and earlier cycling history via the readline module with
+ # up/down is buggy with a color prompt. For more information see:
# http://bugs.python.org/issue12972
#
# To work around this while keeping a color prompt I'm padding the prompt
@@ -805,7 +806,12 @@ def prompt():
if COLOR_PROMPT:
prompt = format(">>> ", Color.GREEN, Attr.BOLD)
- prompt += "\x1b[0m" * 10
+
+ majorVersion = sys.version_info[0]
+ minorVersion = sys.version_info[1]
+
+ if majorVersion <= 2 and minorVersion <= 6:
+ prompt += "\x1b[0m" * 10
else:
prompt = ">>> "
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits