From 851ddad2eeca822e80a6c0582ce05658725807d2 Mon Sep 17 00:00:00 2001 From: Jehan Date: Mon, 13 Feb 2023 13:14:54 +0100 Subject: [PATCH] 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. --- plug-ins/python/python-console/pyconsole.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plug-ins/python/python-console/pyconsole.py b/plug-ins/python/python-console/pyconsole.py index c923e36248..0ede51de44 100644 --- a/plug-ins/python/python-console/pyconsole.py +++ b/plug-ins/python/python-console/pyconsole.py @@ -362,7 +362,8 @@ class _ReadLine(object): cursor line.''' 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 def __get_end(self): @@ -586,6 +587,7 @@ class _Console(_ReadLine, code.InteractiveInterpreter): self.__start() self.run_on_raw_input = start_script + self.raw_input(self.ps1) def do_raw_input(self, text): if self.cmd_buffer: