Replace spaces *before* highlighting contents
The previous change obviously didn't work for renderers like the Pango markup renderer since the highlighting code uses regular spaces and not no-break spaces. Now spaces are replaced in the contents and dividers only, and it's done before highlighting the segment so the added highlighting code stays untouched. Refs #113.
This commit is contained in:
parent
bfdb7f8028
commit
260e40a544
|
@ -125,6 +125,10 @@ class Renderer(object):
|
|||
else:
|
||||
contents_raw = (segment['_space_left'] * ' ') + contents_raw + (segment['_space_right'] * ' ') + outer_padding
|
||||
|
||||
# Replace spaces with no-break spaces
|
||||
contents_raw = contents_raw.replace(' ', u'\u00a0')
|
||||
divider_raw = divider_raw.replace(' ', u'\u00a0')
|
||||
|
||||
# Apply highlighting to padded dividers and contents
|
||||
if render_highlighted:
|
||||
if divider_type == 'soft':
|
||||
|
@ -153,8 +157,6 @@ class Renderer(object):
|
|||
segment['_rendered_raw'] += contents_raw
|
||||
segment['_rendered_hl'] += contents_highlighted
|
||||
segment['_len'] = len(segment['_rendered_raw'])
|
||||
# Replace rendered spaces with no-break spaces
|
||||
segment['_rendered_hl'] = segment['_rendered_hl'].replace(' ', u'\u00a0')
|
||||
yield segment
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in New Issue