|
13 | 13 | # * return an array not larger than the height they were asked for |
14 | 14 |
|
15 | 15 | def display_linize(msg, columns): |
| 16 | + """Returns lines obtained by splitting msg over multiple lines. |
| 17 | +
|
| 18 | + Warning: if msg is empty, returns an empty list of lines""" |
16 | 19 | display_lines = ([msg[start:end] |
17 | 20 | for start, end in zip( |
18 | 21 | range(0, len(msg), columns), |
@@ -50,26 +53,25 @@ def matches_lines(rows, columns, matches, current, config): |
50 | 53 | return matches_lines |
51 | 54 |
|
52 | 55 | def formatted_argspec(argspec): |
53 | | - return argspec[0] + '(' + ", ".join(argspec[1][0]) + ')' |
| 56 | + return argspec[0] + ': (' + ", ".join(argspec[1][0]) + ')' |
54 | 57 |
|
55 | 58 | def paint_infobox(rows, columns, matches, argspec, match, docstring, config): |
56 | 59 | """Returns painted completions, argspec, match, docstring etc.""" |
57 | 60 | if not (rows and columns): |
58 | 61 | return fsarray(0, 0) |
59 | | - width = columns - 2 |
| 62 | + width = columns - 4 |
60 | 63 | color = func_for_letter(config.color_scheme['main']) |
61 | 64 | lines = ((display_linize(blue(formatted_argspec(argspec)), width) if argspec else []) + |
62 | | - ([fmtstr('')] if docstring else []) + |
63 | | - sum(([color(x) for x in display_linize(line, width)] |
| 65 | + sum(([color(x) for x in (display_linize(line, width) if line else fmtstr(''))] |
64 | 66 | for line in docstring.split('\n')) if docstring else [], []) + |
65 | 67 | (matches_lines(rows, columns, matches, match, config) if matches else []) |
66 | 68 | ) |
67 | 69 |
|
68 | 70 | output_lines = [] |
69 | | - output_lines.append(u'┌'+u'─'*width+u'┐') |
| 71 | + output_lines.append(u'┌─'+u'─'*width+u'─┐') |
70 | 72 | for line in lines: |
71 | | - output_lines.append(u'│'+((line+' '*(width - len(line)))[:width])+u'│') |
72 | | - output_lines.append(u'└'+u'─'*width+u'┘') |
| 73 | + output_lines.append(u'│ '+((line+' '*(width - len(line)))[:width])+u' │') |
| 74 | + output_lines.append(u'└─'+u'─'*width+u'─┘') |
73 | 75 | r = fsarray(output_lines[:min(rows-1, len(output_lines)-1)] + output_lines[-1:]) |
74 | 76 | assert len(r.shape) == 2 |
75 | 77 | #return r |
|
0 commit comments