@@ -48,6 +48,14 @@ 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
+
58
+
51
59
def matches_lines (rows , columns , matches , current , config , format ):
52
60
highlight_color = func_for_letter (config .color_scheme ['operator' ].lower ())
53
61
@@ -60,6 +68,8 @@ def matches_lines(rows, columns, matches, current, config, format):
60
68
if current :
61
69
current = format (current )
62
70
71
+ matches = paginate (rows , matches , current , words_wide )
72
+
63
73
matches_lines = [fmtstr (' ' ).join (color (m .ljust (max_match_width ))
64
74
if m != current
65
75
else highlight_color (
@@ -163,12 +173,15 @@ def paint_infobox(rows, columns, matches, funcprops, arg_pos, match, docstring,
163
173
if not (rows and columns ):
164
174
return fsarray (0 , 0 )
165
175
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 []))
176
+ from_argspec = (formatted_argspec (funcprops , arg_pos , width , config )
177
+ if funcprops else [])
178
+ from_doc = (formatted_docstring (docstring , width , config )
179
+ if docstring else [])
180
+ from_matches = (matches_lines (max (1 , rows - len (from_argspec ) - 2 ),
181
+ width , matches , match , config , format )
182
+ if matches else [])
183
+
184
+ lines = from_argspec + from_matches + from_doc
172
185
173
186
def add_border (line ):
174
187
"""Add colored borders left and right to a line."""
0 commit comments