Merge branch 'fix-788' into develop
This commit is contained in:
commit
173159aea4
|
@ -0,0 +1,13 @@
|
||||||
|
# vim:fileencoding=utf-8:noet
|
||||||
|
|
||||||
|
try:
|
||||||
|
from __builtin__ import unicode
|
||||||
|
except ImportError:
|
||||||
|
unicode = str # NOQA
|
||||||
|
|
||||||
|
|
||||||
|
def u(s):
|
||||||
|
if type(s) is unicode:
|
||||||
|
return s
|
||||||
|
else:
|
||||||
|
return unicode(s, 'utf-8')
|
|
@ -17,6 +17,7 @@ from powerline.lib.vcs import guess, tree_status
|
||||||
from powerline.lib.threaded import ThreadedSegment, KwThreadedSegment, with_docstring
|
from powerline.lib.threaded import ThreadedSegment, KwThreadedSegment, with_docstring
|
||||||
from powerline.lib.monotonic import monotonic
|
from powerline.lib.monotonic import monotonic
|
||||||
from powerline.lib.humanize_bytes import humanize_bytes
|
from powerline.lib.humanize_bytes import humanize_bytes
|
||||||
|
from powerline.lib.unicode import u
|
||||||
from powerline.theme import requires_segment_info
|
from powerline.theme import requires_segment_info
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ def cwd(pl, segment_info, dir_shorten_len=None, dir_limit_depth=None, use_path_s
|
||||||
Highlight groups used: ``cwd:current_folder`` or ``cwd``. It is recommended to define all highlight groups.
|
Highlight groups used: ``cwd:current_folder`` or ``cwd``. It is recommended to define all highlight groups.
|
||||||
'''
|
'''
|
||||||
try:
|
try:
|
||||||
cwd = segment_info['getcwd']()
|
cwd = u(segment_info['getcwd']())
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
if e.errno == 2:
|
if e.errno == 2:
|
||||||
# user most probably deleted the directory
|
# user most probably deleted the directory
|
||||||
|
@ -100,7 +101,7 @@ def cwd(pl, segment_info, dir_shorten_len=None, dir_limit_depth=None, use_path_s
|
||||||
cwd = "[not found]"
|
cwd = "[not found]"
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
home = segment_info['home']
|
home = u(segment_info['home'])
|
||||||
if home:
|
if home:
|
||||||
cwd = re.sub('^' + re.escape(home), '~', cwd, 1)
|
cwd = re.sub('^' + re.escape(home), '~', cwd, 1)
|
||||||
cwd_split = cwd.split(os.sep)
|
cwd_split = cwd.split(os.sep)
|
||||||
|
|
|
@ -1,19 +1,7 @@
|
||||||
# vim:fileencoding=utf-8:noet
|
# vim:fileencoding=utf-8:noet
|
||||||
|
|
||||||
from .segment import gen_segment_getter
|
from powerline.segment import gen_segment_getter
|
||||||
|
from powerline.lib.unicode import u, unicode
|
||||||
|
|
||||||
try:
|
|
||||||
from __builtin__ import unicode
|
|
||||||
except ImportError:
|
|
||||||
unicode = str # NOQA
|
|
||||||
|
|
||||||
|
|
||||||
def u(s):
|
|
||||||
if type(s) is unicode:
|
|
||||||
return s
|
|
||||||
else:
|
|
||||||
return unicode(s, 'utf-8')
|
|
||||||
|
|
||||||
|
|
||||||
def requires_segment_info(func):
|
def requires_segment_info(func):
|
||||||
|
|
Loading…
Reference in New Issue