Browse Source

Merge remote-tracking branch 'origin'

pull/250/head
Eugenio Parodi 2 years ago
parent
commit
d9a46fe5f2
  1. 1
      README.md
  2. 29
      TermTk/TTkCore/TTkTerm/input_thread.py

1
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

29
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","<ESC>") + " - "+",".join(hex))

Loading…
Cancel
Save