# Path: ranger.py
# ARGV = sys.argv[1:sys.argv.index('--')] if '--' in sys.argv else sys.argv[1:]
# 
# Path: ranger/ext/widestring.py
# class WideString(object):  # pylint: disable=too-few-public-methods
# 
#     def __init__(self, string, chars=None):
#         try:
#             self.string = str(string)
#         except UnicodeEncodeError:
#             # Here I assume that string is a "unicode" object, because why else
#             # would str(string) raise a UnicodeEncodeError?
#             self.string = string.encode('latin-1', 'ignore')
#         if chars is None:
#             self.chars = string_to_charlist(string)
#         else:
#             self.chars = chars
# 
#     def __add__(self, string):
#         """
#         >>> (WideString("a") + WideString("b")).string
#         'ab'
#         >>> (WideString("a") + WideString("b")).chars
#         ['a', 'b']
#         >>> (WideString("afd") + "bc").chars
#         ['a', 'f', 'd', 'b', 'c']
#         """
#         if isinstance(string, str):
#             return WideString(self.string + string)
#         elif isinstance(string, WideString):
#             return WideString(self.string + string.string, self.chars + string.chars)
#         return None
# 
#     def __radd__(self, string):
#         """
#         >>> ("bc" + WideString("afd")).chars
#         ['b', 'c', 'a', 'f', 'd']
#         """
#         if isinstance(string, str):
#             return WideString(string + self.string)
#         elif isinstance(string, WideString):
#             return WideString(string.string + self.string, string.chars + self.chars)
#         return None
# 
#     def __str__(self):
#         return self.string
# 
#     def __repr__(self):
#         return '<' + self.__class__.__name__ + " '" + self.string + "'>"
# 
#     def __getslice__(self, start, stop):
#         """
#         >>> WideString("asdf")[1:3]
#         <WideString 'sd'>
#         >>> WideString("asdf")[1:-100]
#         <WideString ''>
#         >>> WideString("モヒカン")[2:4]
#         <WideString 'ヒ'>
#         >>> WideString("モヒカン")[2:5]
#         <WideString 'ヒ '>
#         >>> WideString("モabカン")[2:5]
#         <WideString 'ab '>
#         >>> WideString("モヒカン")[1:5]
#         <WideString ' ヒ '>
#         >>> WideString("モヒカン")[:]
#         <WideString 'モヒカン'>
#         >>> WideString("aモ")[0:3]
#         <WideString 'aモ'>
#         >>> WideString("aモ")[0:2]
#         <WideString 'a '>
#         >>> WideString("aモ")[0:1]
#         <WideString 'a'>
#         """
#         if stop is None or stop > len(self.chars):
#             stop = len(self.chars)
#         if stop < 0:
#             stop = len(self.chars) + stop
#         if stop < 0:
#             return WideString("")
#         if start is None or start < 0:
#             start = 0
#         if stop < len(self.chars) and self.chars[stop] == '':
#             if self.chars[start] == '':
#                 return WideString(' ' + ''.join(self.chars[start:stop - 1]) + ' ')
#             return WideString(''.join(self.chars[start:stop - 1]) + ' ')
#         if self.chars[start] == '':
#             return WideString(' ' + ''.join(self.chars[start:stop - 1]))
#         return WideString(''.join(self.chars[start:stop]))
# 
#     def __getitem__(self, i):
#         """
#         >>> WideString("asdf")[2]
#         <WideString 'd'>
#         >>> WideString("……")[0]
#         <WideString '…'>
#         >>> WideString("……")[1]
#         <WideString '…'>
#         """
#         if isinstance(i, slice):
#             return self.__getslice__(i.start, i.stop)
#         return self.__getslice__(i, i + 1)
# 
#     def __len__(self):
#         """
#         >>> len(WideString("poo"))
#         3
#         >>> len(WideString("モヒカン"))
#         8
#         """
#         return len(self.chars)
# 
# def utf_char_width(string):
#     """Return the width of a single character"""
#     if east_asian_width(string) in WIDE_SYMBOLS:
#         return WIDE
#     return NARROW


from ranger import PY3
from ranger.ext.widestring import WideString, utf_char_width
        colorstr.__dict__.update(kw)
        self.append(colorstr)

    def add_space(self, n=1):
        self.add(' ' * n, 'space')

    def sumsize(self):
        return sum(len(item) for item in self)

    def fixedsize(self):
        n = 0
        for item in self:
            if item.fixed:
                n += len(item)
            else:
                n += item.min_size
        return n


class ColoredString(object):

    def __init__(self, string, *lst):
        self.string = WideString(string)
        self.lst = lst
        self.fixed = False
        if not string or not self.string.chars:
            self.min_size = 0
        elif PY3:
            self.min_size = utf_char_width(string[0])
        else:

# Path: ranger.py
# ARGV = sys.argv[1:sys.argv.index('--')] if '--' in sys.argv else sys.argv[1:]
# 
# Path: ranger/ext/widestring.py
# class WideString(object):  # pylint: disable=too-few-public-methods
# 
#     def __init__(self, string, chars=None):
#         try:
#             self.string = str(string)
#         except UnicodeEncodeError:
#             # Here I assume that string is a "unicode" object, because why else
#             # would str(string) raise a UnicodeEncodeError?
#             self.string = string.encode('latin-1', 'ignore')
#         if chars is None:
#             self.chars = string_to_charlist(string)
#         else:
#             self.chars = chars
# 
#     def __add__(self, string):
#         """
#         >>> (WideString("a") + WideString("b")).string
#         'ab'
#         >>> (WideString("a") + WideString("b")).chars
#         ['a', 'b']
#         >>> (WideString("afd") + "bc").chars
#         ['a', 'f', 'd', 'b', 'c']
#         """
#         if isinstance(string, str):
#             return WideString(self.string + string)
#         elif isinstance(string, WideString):
#             return WideString(self.string + string.string, self.chars + string.chars)
#         return None
# 
#     def __radd__(self, string):
#         """
#         >>> ("bc" + WideString("afd")).chars
#         ['b', 'c', 'a', 'f', 'd']
#         """
#         if isinstance(string, str):
#             return WideString(string + self.string)
#         elif isinstance(string, WideString):
#             return WideString(string.string + self.string, string.chars + self.chars)
#         return None
# 
#     def __str__(self):
#         return self.string
# 
#     def __repr__(self):
#         return '<' + self.__class__.__name__ + " '" + self.string + "'>"
# 
#     def __getslice__(self, start, stop):
#         """
#         >>> WideString("asdf")[1:3]
#         <WideString 'sd'>
#         >>> WideString("asdf")[1:-100]
#         <WideString ''>
#         >>> WideString("モヒカン")[2:4]
#         <WideString 'ヒ'>
#         >>> WideString("モヒカン")[2:5]
#         <WideString 'ヒ '>
#         >>> WideString("モabカン")[2:5]
#         <WideString 'ab '>
#         >>> WideString("モヒカン")[1:5]
#         <WideString ' ヒ '>
#         >>> WideString("モヒカン")[:]
#         <WideString 'モヒカン'>
#         >>> WideString("aモ")[0:3]
#         <WideString 'aモ'>
#         >>> WideString("aモ")[0:2]
#         <WideString 'a '>
#         >>> WideString("aモ")[0:1]
#         <WideString 'a'>
#         """
#         if stop is None or stop > len(self.chars):
#             stop = len(self.chars)
#         if stop < 0:
#             stop = len(self.chars) + stop
#         if stop < 0:
#             return WideString("")
#         if start is None or start < 0:
#             start = 0
#         if stop < len(self.chars) and self.chars[stop] == '':
#             if self.chars[start] == '':
#                 return WideString(' ' + ''.join(self.chars[start:stop - 1]) + ' ')
#             return WideString(''.join(self.chars[start:stop - 1]) + ' ')
#         if self.chars[start] == '':
#             return WideString(' ' + ''.join(self.chars[start:stop - 1]))
#         return WideString(''.join(self.chars[start:stop]))
# 
#     def __getitem__(self, i):
#         """
#         >>> WideString("asdf")[2]
#         <WideString 'd'>
#         >>> WideString("……")[0]
#         <WideString '…'>
#         >>> WideString("……")[1]
#         <WideString '…'>
#         """
#         if isinstance(i, slice):
#             return self.__getslice__(i.start, i.stop)
#         return self.__getslice__(i, i + 1)
# 
#     def __len__(self):
#         """
#         >>> len(WideString("poo"))
#         3
#         >>> len(WideString("モヒカン"))
#         8
#         """
#         return len(self.chars)
# 
# def utf_char_width(string):
#     """Return the width of a single character"""
#     if east_asian_width(string) in WIDE_SYMBOLS:
#         return WIDE
#     return NARROW


# Path: ranger/gui/bar.py
from ranger import PY3
from ranger.ext.widestring import WideString, utf_char_width

        colorstr.__dict__.update(kw)
        self.append(colorstr)

    def add_space(self, n=1):
        self.add(' ' * n, 'space')

    def sumsize(self):
        return sum(len(item) for item in self)

    def fixedsize(self):
        n = 0
        for item in self:
            if item.fixed:
                n += len(item)
            else:
                n += item.min_size
        return n


class ColoredString(object):

    def __init__(self, string, *lst):
        self.string = WideString(string)
        self.lst = lst
        self.fixed = False
        if not string or not self.string.chars:
            self.min_size = 0
        elif PY3:
            self.min_size = utf_char_width(string[0])
        else:

            self.min_size = utf_char_width(self.string.chars[0].decode('utf-8'))