diff options
| author | troido <troido@protonmail.com> | 2019-09-27 15:30:27 +0200 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2019-09-27 15:30:27 +0200 |
| commit | ee27ed9af13bd2e9f5de4d69830c5a88a6cdf219 (patch) | |
| tree | b7b5781829f4cde39066fef1b81215c88e122748 /asciifarm/client | |
| parent | fd6b7dbcf3c1a6a7550e4e735b54925825889bd6 (diff) | |
accept non-ascii characters in chat; adapt to new ratuil textinput
Diffstat (limited to 'asciifarm/client')
| -rw-r--r-- | asciifarm/client/inputhandler.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/asciifarm/client/inputhandler.py b/asciifarm/client/inputhandler.py index b2e4ac9..0657749 100644 --- a/asciifarm/client/inputhandler.py +++ b/asciifarm/client/inputhandler.py @@ -55,13 +55,10 @@ class InputHandler: self.showString() def showString(self): - self.client.display.setInputString(self.string, self.cursor if self.typing else -1) + self.client.display.setInputString(self.string, self.cursor if self.typing else None) def addKey(self, key): - if key in string.printable: - self.string = self.string[:self.cursor] + key + self.string[self.cursor:] - self.cursor += 1 - elif key == inp.BACKSPACE: + if key == inp.BACKSPACE: self.string = self.string[:self.cursor-1] + self.string[self.cursor:] self.cursor = max(self.cursor - 1, 0) elif key == inp.RIGHT: @@ -90,6 +87,9 @@ class InputHandler: elif key == "^I": # tab # return to game but keep entered string self.typing = False + elif key.isprintable(): + self.string = self.string[:self.cursor] + key + self.string[self.cursor:] + self.cursor += len(key) self.showString() |
