Show More
@@ -204,6 +204,12 b' class LineFrontEndBase(FrontEndBase):' | |||||
204 | print >>sys.__stdout__, completions |
|
204 | print >>sys.__stdout__, completions | |
205 |
|
205 | |||
206 |
|
206 | |||
|
207 | def get_line_width(self): | |||
|
208 | """ Return the width of the line in characters. | |||
|
209 | """ | |||
|
210 | return 80 | |||
|
211 | ||||
|
212 | ||||
207 | def write_completion(self, possibilities): |
|
213 | def write_completion(self, possibilities): | |
208 | """ Write the list of possible completions. |
|
214 | """ Write the list of possible completions. | |
209 | """ |
|
215 | """ | |
@@ -212,8 +218,8 b' class LineFrontEndBase(FrontEndBase):' | |||||
212 | self.write('\n') |
|
218 | self.write('\n') | |
213 | max_len = len(max(possibilities, key=len)) + 1 |
|
219 | max_len = len(max(possibilities, key=len)) + 1 | |
214 |
|
220 | |||
215 |
# |
|
221 | # Now we check how much symbol we can put on a line... | |
216 | chars_per_line =self.get_line_width() |
|
222 | chars_per_line = self.get_line_width() | |
217 | symbols_per_line = max(1, chars_per_line/max_len) |
|
223 | symbols_per_line = max(1, chars_per_line/max_len) | |
218 |
|
224 | |||
219 | pos = 1 |
|
225 | pos = 1 | |
@@ -231,7 +237,6 b' class LineFrontEndBase(FrontEndBase):' | |||||
231 | self.input_buffer = current_buffer |
|
237 | self.input_buffer = current_buffer | |
232 |
|
238 | |||
233 |
|
239 | |||
234 |
|
||||
235 | def new_prompt(self, prompt): |
|
240 | def new_prompt(self, prompt): | |
236 | """ Prints a prompt and starts a new editing buffer. |
|
241 | """ Prints a prompt and starts a new editing buffer. | |
237 |
|
242 |
@@ -115,6 +115,9 b' def test_completion():' | |||||
115 | f.input_buffer = 'zzzb = 2' |
|
115 | f.input_buffer = 'zzzb = 2' | |
116 | f._on_enter() |
|
116 | f._on_enter() | |
117 | f.input_buffer = 'zz' |
|
117 | f.input_buffer = 'zz' | |
|
118 | f.complete_current_input() | |||
|
119 | assert f.out.getvalue() == '\nzzza zzzb ' | |||
|
120 | assert f.input_buffer == 'zzz' | |||
118 |
|
121 | |||
119 |
|
122 | |||
120 | if __name__ == '__main__': |
|
123 | if __name__ == '__main__': | |
@@ -123,3 +126,4 b" if __name__ == '__main__':" | |||||
123 | test_execution() |
|
126 | test_execution() | |
124 | test_multiline() |
|
127 | test_multiline() | |
125 | test_capture() |
|
128 | test_capture() | |
|
129 | test_completion() |
General Comments 0
You need to be logged in to leave comments.
Login now