Fix handling of segment include_modes

Segments should only be included if rules for both inclusion and
exclusion are satisfied, satisfying one or the other is not sufficient.

If the include_modes list for a segment is missing or empty consider all
modes to be included so that users do not need to supply an exhaustive
list, since there isn't much point in actually wanting an empty include
list.  Actually check for mode name in the list rather than mistakenly
checking for the segment object.
This commit is contained in:
Aaron Schrab 2013-04-08 13:51:24 -04:00
parent 70e279afde
commit 51a5b430a8

View File

@ -186,7 +186,7 @@ class Renderer(object):
# Handle excluded/included segments for the current mode
segments = [self._get_highlighting(segment, mode) for segment in segments
if mode not in segment['exclude_modes'] or (segment['include_modes'] and segment in segment['include_modes'])]
if mode not in segment['exclude_modes'] and (not segment['include_modes'] or mode in segment['include_modes'])]
segments = [segment for segment in self._render_segments(theme, segments)]