@@ -48,6 +48,13 @@ def paint_current_line(rows, columns, current_display_line):
48
48
return fsarray (lines , width = columns )
49
49
50
50
51
+ def paginate (rows , matches , current , words_wide ):
52
+ if current not in matches :
53
+ current = matches [0 ]
54
+ per_page = rows * words_wide
55
+ current_page = matches .index (current ) // per_page
56
+ return matches [per_page * current_page :per_page * (current_page + 1 )]
57
+
51
58
def matches_lines (rows , columns , matches , current , config , format ):
52
59
highlight_color = func_for_letter (config .color_scheme ['operator' ].lower ())
53
60
@@ -60,6 +67,8 @@ def matches_lines(rows, columns, matches, current, config, format):
60
67
if current :
61
68
current = format (current )
62
69
70
+ matches = paginate (rows , matches , current , words_wide )
71
+
63
72
matches_lines = [fmtstr (' ' ).join (color (m .ljust (max_match_width ))
64
73
if m != current
65
74
else highlight_color (
@@ -163,12 +172,15 @@ def paint_infobox(rows, columns, matches, funcprops, arg_pos, match, docstring,
163
172
if not (rows and columns ):
164
173
return fsarray (0 , 0 )
165
174
width = columns - 4
166
- lines = ((formatted_argspec (funcprops , arg_pos , width , config )
167
- if funcprops else []) +
168
- (matches_lines (rows , width , matches , match , config , format )
169
- if matches else []) +
170
- (formatted_docstring (docstring , width , config )
171
- if docstring else []))
175
+ from_argspec = (formatted_argspec (funcprops , arg_pos , width , config )
176
+ if funcprops else [])
177
+ from_doc = (formatted_docstring (docstring , width , config )
178
+ if docstring else [])
179
+ from_matches = (matches_lines (max (1 , rows - len (from_argspec ) - 2 ),
180
+ width , matches , match , config , format )
181
+ if matches else [])
182
+
183
+ lines = from_argspec + from_matches + from_doc
172
184
173
185
def add_border (line ):
174
186
"""Add colored borders left and right to a line."""
0 commit comments