Skip to content

Commit

Permalink
Fix for zsh non printing colours
Browse files Browse the repository at this point in the history
  • Loading branch information
ltn100 committed Aug 1, 2020
1 parent 0b753df commit e53c9a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion prompty/__init__.py
Expand Up @@ -2,7 +2,7 @@
# vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:

# Must comply with http://legacy.python.org/dev/peps/pep-0440/#version-scheme
__version__ = "0.4.0"
__version__ = "0.4.1rc1"

from . import prompt
from . import functions
Expand Down
14 changes: 12 additions & 2 deletions prompty/colours.py
Expand Up @@ -9,6 +9,7 @@
# Import external modules
import re
import types
import os

from prompty import functionBase

Expand Down Expand Up @@ -58,11 +59,20 @@ class Colours(functionBase.PromptyFunctions):
STYLES = [NORMAL, BOLD, DIM, ITALIC, UNDERLINE, BLINK, INVERTED]

RESET_KEY = 0
NOCOUNT_START = "\001"
NOCOUNT_END = "\002"
NOCOUNT_START_BASH = "\001"
NOCOUNT_END_BASH = "\002"
NOCOUNT_START_ZSH = "%{"
NOCOUNT_END_ZSH = "%}"
ESCAPE_CHAR = "\033["
END_CODE = "m"

if os.environ.get('SHELL', 'sh').split(os.pathsep)[-1] == "zsh":
NOCOUNT_START = NOCOUNT_START_ZSH
NOCOUNT_END = NOCOUNT_END_ZSH
else:
NOCOUNT_START = NOCOUNT_START_BASH
NOCOUNT_END = NOCOUNT_END_BASH

def __init__(self, container):
self._populateFunctions()
super(Colours, self).__init__(container)
Expand Down

0 comments on commit e53c9a6

Please sign in to comment.