plug-ins: add back the prompt when "clearing" the Python console.

This code is taken from Massimo's comment in #1786 and MR !834. It doesn't fix
a crash as this was already handled in !404, yet the missing prompt after
hitting "clear" was clearly not consistent with how one expect a clear feature
to work.

At least now, we've got a prompt back immediately after clearing.
This commit is contained in:
Jehan 2023-02-13 13:14:54 +01:00
parent d19a397cf8
commit 851ddad2ee
1 changed files with 3 additions and 1 deletions

View File

@ -362,7 +362,8 @@ class _ReadLine(object):
cursor line.''' cursor line.'''
iter = self.__get_cursor() iter = self.__get_cursor()
iter.set_line_offset(len(self.ps)) iter.set_line(iter.get_line())
iter.forward_chars(len(self.ps))
return iter return iter
def __get_end(self): def __get_end(self):
@ -586,6 +587,7 @@ class _Console(_ReadLine, code.InteractiveInterpreter):
self.__start() self.__start()
self.run_on_raw_input = start_script self.run_on_raw_input = start_script
self.raw_input(self.ps1)
def do_raw_input(self, text): def do_raw_input(self, text):
if self.cmd_buffer: if self.cmd_buffer: