@@ -48,6 +48,14 @@ def paint_current_line(rows, columns, current_display_line):
4848 return fsarray (lines , width = columns )
4949
5050
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+
5159def matches_lines (rows , columns , matches , current , config , format ):
5260 highlight_color = func_for_letter (config .color_scheme ['operator' ].lower ())
5361
@@ -60,6 +68,8 @@ def matches_lines(rows, columns, matches, current, config, format):
6068 if current :
6169 current = format (current )
6270
71+ matches = paginate (rows , matches , current , words_wide )
72+
6373 matches_lines = [fmtstr (' ' ).join (color (m .ljust (max_match_width ))
6474 if m != current
6575 else highlight_color (
@@ -163,12 +173,15 @@ def paint_infobox(rows, columns, matches, funcprops, arg_pos, match, docstring,
163173 if not (rows and columns ):
164174 return fsarray (0 , 0 )
165175 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
172185
173186 def add_border (line ):
174187 """Add colored borders left and right to a line."""
0 commit comments