Returns painted completions, funcprops, match, docstring etc.
(
rows,
columns,
matches,
funcprops,
arg_pos,
match,
docstring,
config,
match_format,
)
| 185 | |
| 186 | |
| 187 | def paint_infobox( |
| 188 | rows, |
| 189 | columns, |
| 190 | matches, |
| 191 | funcprops, |
| 192 | arg_pos, |
| 193 | match, |
| 194 | docstring, |
| 195 | config, |
| 196 | match_format, |
| 197 | ): |
| 198 | """Returns painted completions, funcprops, match, docstring etc.""" |
| 199 | if not (rows and columns): |
| 200 | return FSArray(0, 0) |
| 201 | width = columns - 4 |
| 202 | from_argspec = ( |
| 203 | formatted_argspec(funcprops, arg_pos, width, config) |
| 204 | if funcprops |
| 205 | else [] |
| 206 | ) |
| 207 | from_doc = ( |
| 208 | formatted_docstring(docstring, width, config) if docstring else [] |
| 209 | ) |
| 210 | from_matches = ( |
| 211 | matches_lines( |
| 212 | max(1, rows - len(from_argspec) - 2), |
| 213 | width, |
| 214 | matches, |
| 215 | match, |
| 216 | config, |
| 217 | match_format, |
| 218 | ) |
| 219 | if matches |
| 220 | else [] |
| 221 | ) |
| 222 | |
| 223 | lines = from_argspec + from_matches + from_doc |
| 224 | |
| 225 | def add_border(line): |
| 226 | """Add colored borders left and right to a line.""" |
| 227 | new_line = border_color(config.left_border + " ") |
| 228 | new_line += line.ljust(width)[:width] |
| 229 | new_line += border_color(" " + config.right_border) |
| 230 | return new_line |
| 231 | |
| 232 | border_color = func_for_letter(config.color_scheme["main"]) |
| 233 | |
| 234 | top_line = border_color( |
| 235 | config.left_top_corner |
| 236 | + config.top_border * (width + 2) |
| 237 | + config.right_top_corner |
| 238 | ) |
| 239 | bottom_line = border_color( |
| 240 | config.left_bottom_corner |
| 241 | + config.bottom_border * (width + 2) |
| 242 | + config.right_bottom_corner |
| 243 | ) |
| 244 |
nothing calls this directly
no test coverage detected