From 1f4c77db5d1098d9ef8e8a136dae1a109ae2aff0 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Feb 2014 20:40:40 +0400 Subject: [PATCH] Do not take number of subsegments into account, work without parser_state --- powerline/segments/shell.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/powerline/segments/shell.py b/powerline/segments/shell.py index a15b5522..750c6f25 100644 --- a/powerline/segments/shell.py +++ b/powerline/segments/shell.py @@ -79,8 +79,7 @@ def continuation(pl, segment_info, omit_cmdsubst=True, right_align=False, rename '''Display parser state. :param bool omit_cmdsubst: - Do not display cmdsubst parser state if it is the last, but not the only - one. + Do not display cmdsubst parser state if it is the last one. :param bool right_align: Align to the right. :param dict renames: @@ -89,7 +88,7 @@ def continuation(pl, segment_info, omit_cmdsubst=True, right_align=False, rename Highlight groups used: ``continuation``, ``continuation:current``. ''' - if not segment_info['parser_state']: + if not segment_info.get('parser_state'): return None ret = [] @@ -102,7 +101,7 @@ def continuation(pl, segment_info, omit_cmdsubst=True, right_align=False, rename 'draw_inner_divider': True, }) - if omit_cmdsubst and len(ret) > 1 and ret[-1]['contents'] == 'cmdsubst': + if omit_cmdsubst and ret[-1]['contents'] == 'cmdsubst': ret.pop(-1) if not ret: