Fix hard divider rendering issue

Hard dividers (for segments with different background colors) are now
always drawn, regardless of the draw_divider option, because it looks
horrible when segments with different bg colors don't have a divider
between them.

This resolves an issue with the filename and modified flag
in the default theme where the filename segment had to set the
draw_divider flag based on the contents of the modified flag to be
rendered correctly.
This commit is contained in:
Kim Silkebækken 2012-11-26 15:07:05 +01:00
parent 34da25418c
commit 6a9bb45157
2 changed files with 6 additions and 6 deletions

View File

@ -158,11 +158,11 @@ def statusline(winnr):
mksegment(windata['branch'], 250, 240, priority=60), mksegment(windata['branch'], 250, 240, priority=60),
mksegment(windata['readonly'], 196, 240, draw_divider=False), mksegment(windata['readonly'], 196, 240, draw_divider=False),
mksegment(windata['filepath'], 250, 240, draw_divider=False, priority=40), mksegment(windata['filepath'], 250, 240, draw_divider=False, priority=40),
mksegment(windata['filename'], windata['filename_color'], 240, attr=Powerline.ATTR_BOLD, draw_divider=not len(windata['modified'])), mksegment(windata['filename'], windata['filename_color'], 240, attr=Powerline.ATTR_BOLD, draw_divider=False),
mksegment(windata['modified'], 220, 240, attr=Powerline.ATTR_BOLD), mksegment(windata['modified'], 220, 240, attr=Powerline.ATTR_BOLD),
mksegment(windata['currenttag'], 246, 236, draw_divider=False, priority=100), mksegment(windata['currenttag'], 246, 236, draw_divider=False, priority=100),
mksegment(filler=True, cterm_fg=236, cterm_bg=236), mksegment(filler=True, cterm_fg=236, cterm_bg=236),
mksegment(windata['fileformat'], 247, 236, side='r', priority=50), mksegment(windata['fileformat'], 247, 236, side='r', priority=50, draw_divider=False),
mksegment(windata['fileencoding'], 247, 236, side='r', priority=50), mksegment(windata['fileencoding'], 247, 236, side='r', priority=50),
mksegment(windata['filetype'], 247, 236, side='r', priority=50), mksegment(windata['filetype'], 247, 236, side='r', priority=50),
mksegment(windata['line_percent'], windata['line_percent_color'], 240, side='r', priority=30), mksegment(windata['line_percent'], windata['line_percent_color'], 240, side='r', priority=30),

View File

@ -81,10 +81,10 @@ class Powerline(object):
if segment['filler']: if segment['filler']:
# Filler segments shouldn't be padded # Filler segments shouldn't be padded
rendered_highlighted += segment['contents'] rendered_highlighted += segment['contents']
elif segment['draw_divider'] and (divider_type == 'hard' or segment['side'] == compare['side']): elif segment['draw_divider'] or divider_type == 'hard':
# Draw divider if specified, and if the next segment is on # Draw divider if specified, or if it's a hard divider
# the opposite side only draw the divider if it's a hard # Note: Hard dividers are always drawn, regardless of
# divider # the draw_divider option
if segment['side'] == 'l': if segment['side'] == 'l':
segment['rendered_raw'] += outer_padding + segment['contents'] + ' ' + divider + ' ' segment['rendered_raw'] += outer_padding + segment['contents'] + ' ' + divider + ' '
rendered_highlighted += segment_hl + outer_padding + segment['contents'] + ' ' + divider_hl + divider + ' ' rendered_highlighted += segment_hl + outer_padding + segment['contents'] + ' ' + divider_hl + divider + ' '