1
0
mirror of https://github.com/chubin/cheat.sh.git synced 2026-06-20 13:16:44 +02:00

frontent/ansi.py minor fix

This commit is contained in:
Igor Chubin
2019-02-17 14:10:43 +01:00
parent 94870b8192
commit f70b13ac34
+16 -15
View File
@@ -102,21 +102,7 @@ def _visualize(answers, request_options, search_mode=False):
answer = answer_dict['answer']
found = found and not topic_type == 'unknown'
if answer_dict['format'] in ['ansi', 'text']:
result += answer
elif topic == ':firstpage-v1':
result += fmt.internal.colorize_internal_firstpage_v1(answer)
elif topic == 'LIMITED':
result += _limited_answer(answer)
else:
result += _colorize_ansi_answer(
topic, answer, color_style,
highlight_all=highlight,
highlight_code=(topic_type == 'question'
and not request_options.get('add_comments')
and not request_options.get('remove_text')))
if search_mode:
if search_mode and topic != 'LIMITED':
if not highlight:
result += "\n[%s]\n" % topic
else:
@@ -125,5 +111,20 @@ def _visualize(answers, request_options, search_mode=False):
topic,
colored.attr("res_underlined"), colored.attr('reset'))
if answer_dict['format'] in ['ansi', 'text']:
result += answer
elif topic == ':firstpage-v1':
result += fmt.internal.colorize_internal_firstpage_v1(answer)
elif topic == 'LIMITED':
result += _limited_answer(topic)
else:
result += _colorize_ansi_answer(
topic, answer, color_style,
highlight_all=highlight,
highlight_code=(topic_type == 'question'
and not request_options.get('add_comments')
and not request_options.get('remove_text')))
result = result.strip('\n') + "\n"
return result, found