diff --git a/README.md b/README.md index 47c8688f..1cc81ac9 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ python3 tests/test.ui.018.TextEdit.Pygments.py README.md - [pytest-fold](https://github.com/jeffwright13/pytest-fold) - A Pytest plugin to make console output more manageable when there are multiple failed tests - [pytest-tui](https://github.com/jeffwright13/pytest-tui) - A Text User Interface (TUI) for Pytest, automatically launched after your test run is finished - [breakoutRL](https://ceccopierangiolieugenio.itch.io/breakoutrl) - Breakout the Roguelike +- [7drl-2024](https://ceccopierangiolieugenio.itch.io/a-snake-on-a-plane) - A Snake🐍 on a Plane✈️ - The Roguelike ## Related Projects - Honourable mention diff --git a/TermTk/TTkCore/TTkTerm/input_thread.py b/TermTk/TTkCore/TTkTerm/input_thread.py index 2e0808a9..216be61a 100644 --- a/TermTk/TTkCore/TTkTerm/input_thread.py +++ b/TermTk/TTkCore/TTkTerm/input_thread.py @@ -111,20 +111,24 @@ class TTkInput: TTkInput._inputQueue.put(outq) TTkInput._inputQueue.put(None) + @staticmethod + def _handleBracketedPaste(stdinRead:str): + if stdinRead.endswith("\033[201~"): + TTkInput._pasteBuffer += stdinRead[:-6] + TTkInput._bracketedPaste = False + # due to the CRNL methos (don't ask me why) the terminal + # is substituting all the \n with \r + _paste = TTkInput._pasteBuffer.replace('\r','\n') + TTkInput._pasteBuffer = "" + return None, None, _paste + else: + TTkInput._pasteBuffer += stdinRead + return None, None, None + @staticmethod def key_process(stdinRead:str) -> None: if TTkInput._bracketedPaste: - if stdinRead.endswith("\033[201~"): - TTkInput._pasteBuffer += stdinRead[:-6] - TTkInput._bracketedPaste = False - # due to the CRNL methos (don't ask me why) the terminal - # is substituting all the \n with \r - _paste = TTkInput._pasteBuffer.replace('\r','\n') - TTkInput._pasteBuffer = "" - return None, None, _paste - else: - TTkInput._pasteBuffer += stdinRead - return None, None, None + return TTkInput._handleBracketedPaste(stdinRead) mevt,kevt = None,None @@ -205,9 +209,8 @@ class TTkInput: return kevt, mevt, None if stdinRead.startswith("\033[200~"): - TTkInput._pasteBuffer = stdinRead[6:] TTkInput._bracketedPaste = True - return None, None, None + return TTkInput._handleBracketedPaste(stdinRead[6:]) hex = [f"0x{ord(x):02x}" for x in stdinRead] TTkLog.error("UNHANDLED: "+stdinRead.replace("\033","") + " - "+",".join(hex))