From f70b13ac34e31d5b1ed6435cd50ec98b773df57c Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Sun, 17 Feb 2019 14:10:43 +0100 Subject: [PATCH] frontent/ansi.py minor fix --- lib/frontend/ansi.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/frontend/ansi.py b/lib/frontend/ansi.py index 755587f..7b89c3d 100644 --- a/lib/frontend/ansi.py +++ b/lib/frontend/ansi.py @@ -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