diff options
-rw-r--r-- | pym/output.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pym/output.py b/pym/output.py index 08e4d8401..f59609ee7 100644 --- a/pym/output.py +++ b/pym/output.py @@ -231,6 +231,11 @@ def nc_len(mystr): def xtermTitle(mystr, raw=False): if dotitles and "TERM" in os.environ and sys.stderr.isatty(): + # If the title string is too big then the terminal can + # misbehave. Therefore, truncate it if it's too big. + max_len = 253 + if len(mystr) > max_len: + mystr = mystr[:max_len] myt=os.environ["TERM"] legal_terms = ["xterm","Eterm","aterm","rxvt","screen","kterm","rxvt-unicode","gnome"] for term in legal_terms: |