1+ # -*- coding: utf-8 -*-
12
23from fmtstr .fmtfuncs import *
34from fmtstr .fsarray import fsarray
@@ -32,13 +33,14 @@ def paint_current_line(rows, columns, current_display_line):
3233 lines = display_linize (current_display_line , columns )
3334 return fsarray ([(line + ' ' * columns )[:columns ] for line in lines ])
3435
35- def matches_lines (rows , columns , matches , current ):
36+ def matches_lines (rows , columns , matches , current , config ):
3637 highlight_color = lambda x : red (on_blue (x ))
3738 if not matches :
3839 return []
40+ color = func_for_letter (config .color_scheme ['main' ])
3941 max_match_width = max (len (m ) for m in matches )
4042 words_wide = max (1 , (columns - 1 ) / (max_match_width + 1 ))
41- matches_lines = [fmtstr (' ' ).join (m .ljust (max_match_width )
43+ matches_lines = [fmtstr (' ' ).join (color ( m .ljust (max_match_width ) )
4244 if m != current
4345 else highlight_color (m ) + ' ' * (max_match_width - len (m ))
4446 for m in matches [i :i + words_wide ])
@@ -54,19 +56,21 @@ def paint_infobox(rows, columns, matches, argspec, match, docstring, config):
5456 """Returns painted completions, argspec, match, docstring etc."""
5557 if not (rows and columns ):
5658 return fsarray (0 , 0 )
59+ color = func_for_letter (config .color_scheme ['main' ])
5760 lines = ((display_linize (blue (formatted_argspec (argspec )), columns - 2 ) if argspec else []) +
58- (display_linize (str (argspec ), columns - 2 ) if argspec else []) +
59- sum ((display_linize (line , columns - 2 ) for line in docstring .split ('\n ' )) if docstring else [], []) +
60- (matches_lines (rows , columns , matches , match ) if matches else [])
61+ ([fmtstr ('' )] if docstring else []) +
62+ sum (([color (x ) for x in display_linize (line , columns - 2 )]
63+ for line in docstring .split ('\n ' )) if docstring else [], []) +
64+ (matches_lines (rows , columns , matches , match , config ) if matches else [])
6165 )
6266
6367 # add borders
6468 width = min (columns - 2 , max ([len (line ) for line in lines ]))
6569 output_lines = []
66- output_lines .append ('+ ' + '- ' * width + '+ ' )
70+ output_lines .append ('┌ ' + '─ ' * width + '┐ ' )
6771 for line in lines :
6872 output_lines .append ('|' + ((line + ' ' * (width - len (line )))[:width ])+ '|' )
69- output_lines .append ('+ ' + '- ' * width + '+ ' )
73+ output_lines .append ('└ ' + '─ ' * width + '┘ ' )
7074 r = fsarray (output_lines [:rows ])
7175 assert len (r .shape ) == 2
7276 #return r
0 commit comments