gh-111201: Allow bracketed paste to work (GH-118700)

This commit is contained in:
Pablo Galindo Salgado 2024-05-07 13:54:56 +01:00 committed by GitHub
parent ad3d877a12
commit 7d90b8aadb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 61 additions and 0 deletions

View file

@ -336,10 +336,13 @@ class UnixConsole(Console):
except ValueError:
pass
self.__enable_bracketed_paste()
def restore(self):
"""
Restore the console to the default state
"""
self.__disable_bracketed_paste()
self.__maybe_write_code(self._rmkx)
self.flushoutput()
tcsetattr(self.input_fd, termios.TCSADRAIN, self.__svtermstate)
@ -525,6 +528,12 @@ class UnixConsole(Console):
self.__posxy = 0, 0
self.screen = []
def __enable_bracketed_paste(self) -> None:
os.write(self.output_fd, b"\x1b[?2004h")
def __disable_bracketed_paste(self) -> None:
os.write(self.output_fd, b"\x1b[?2004l")
def __setup_movement(self):
"""
Set up the movement functions based on the terminal capabilities.