Clear the buffer, redraw the screen and re-evaluate the history
(self)
| 872 | return reply.lower() in ("y", "yes") |
| 873 | |
| 874 | def reevaluate(self): |
| 875 | """Clear the buffer, redraw the screen and re-evaluate the history""" |
| 876 | |
| 877 | self.evaluating = True |
| 878 | self.stdout_hist = "" |
| 879 | self.f_string = "" |
| 880 | self.buffer = [] |
| 881 | self.scr.erase() |
| 882 | # Set cursor position to -1 to prevent paren matching |
| 883 | self.cpos = -1 |
| 884 | |
| 885 | self.prompt(False) |
| 886 | |
| 887 | self.iy, self.ix = self.scr.getyx() |
| 888 | for line in self.history: |
| 889 | self.stdout_hist += line + "\n" |
| 890 | self.print_line(line) |
| 891 | # I decided it was easier to just do this manually |
| 892 | # than to make the print_line and history stuff more flexible. |
| 893 | self.scr.addstr("\n") |
| 894 | more = self.push(line) |
| 895 | self.prompt(more) |
| 896 | self.iy, self.ix = self.scr.getyx() |
| 897 | |
| 898 | self.cpos = 0 |
| 899 | indent = repl.next_indentation(self.s, self.config.tab_length) |
| 900 | self.s = "" |
| 901 | self.scr.refresh() |
| 902 | |
| 903 | if self.buffer: |
| 904 | for unused in range(indent): |
| 905 | self.tab() |
| 906 | |
| 907 | self.evaluating = False |
| 908 | # map(self.push, self.history) |
| 909 | # ^-- That's how simple this method was at first :( |
| 910 | |
| 911 | def write(self, s): |
| 912 | """For overriding stdout defaults""" |
nothing calls this directly
no test coverage detected