Make sure that if client_id is None then width is not used

This commit is contained in:
ZyX 2015-01-08 00:12:48 +03:00
parent 3ba6948d56
commit 0942b3d8c4
1 changed files with 14 additions and 13 deletions

View File

@ -48,18 +48,18 @@ class ShellRenderer(Renderer):
client_id = segment_info.get('client_id') client_id = segment_info.get('client_id')
else: else:
client_id = None client_id = None
local_key = (client_id, side, None if theme is self.theme else id(theme)) if client_id is not None:
key = (client_id, side, None) local_key = (client_id, side, None if theme is self.theme else id(theme))
did_width = False key = (client_id, side, None)
if local_key[-1] != key[-1] and side == 'left': did_width = False
try: if local_key[-1] != key[-1] and side == 'left':
width = self.old_widths[key] try:
except KeyError: width = self.old_widths[key]
pass except KeyError:
else: pass
did_width = True else:
if not did_width: did_width = True
if width is not None: if not did_width and width is not None:
if theme.cursor_space_multiplier is not None: if theme.cursor_space_multiplier is not None:
width = int(width * theme.cursor_space_multiplier) width = int(width * theme.cursor_space_multiplier)
elif theme.cursor_columns: elif theme.cursor_columns:
@ -78,7 +78,8 @@ class ShellRenderer(Renderer):
side=side, side=side,
**kwargs **kwargs
) )
self.old_widths[local_key] = res[-1] if client_id is not None:
self.old_widths[local_key] = res[-1]
ret = res if output_width else res[:-1] ret = res if output_width else res[:-1]
if len(ret) == 1: if len(ret) == 1:
return ret[0] return ret[0]