diff options
author | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-01-14 11:30:57 +0200 |
---|---|---|
committer | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-01-14 11:30:57 +0200 |
commit | 1f9bba90256f0baf605636a93037f1debdcb4623 (patch) | |
tree | 3d2490a3900692719ee4350e1e711a1696054079 /tui/static.py | |
parent | 9087617e2e023010f5386f222303292dbd015996 (diff) |
Making keyboard reader match only the start of the buffer.
Diffstat (limited to 'tui/static.py')
-rw-r--r-- | tui/static.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/tui/static.py b/tui/static.py index cb934f0..ecd80b9 100644 --- a/tui/static.py +++ b/tui/static.py @@ -13,17 +13,21 @@ class Action(Enum): RIGHT = 6 UP = 7 DOWN = 8 + TOP = 9 + BOTTOM = 10 + BEGIN = 11 + END = 12 + NOOP = 13 +# ActionKeys - Ohjelma vertaa syötteen alkua näihin ja palauttaa ekan ActionKeys = { - 'w': Action.UP, 'a': Action.LEFT, 's': Action.DOWN, - 'd': Action.RIGHT, ' ': Action.OPEN, '\n': Action.OPEN, - 'f': Action.FLAG, 'm': Action.FLAG, 'q': Action.QUIT -} - - -ActionEscKeys = { - '': Action.QUIT, 'A': Action.UP, 'D': Action.LEFT, - 'C': Action.RIGHT, 'B': Action.DOWN + "\033[A": Action.UP, "\033[D": Action.LEFT, + "\033[C": Action.RIGHT, '\033[B': Action.DOWN, "\033[5~": Action.TOP, + "\033[6~": Action.BOTTOM, "\033[7~": Action.BEGIN,"\033[8~": Action.END, + "\033[": Action.NOOP, "\033": Action.QUIT, + "w": Action.UP, "a": Action.LEFT, "s": Action.DOWN, + "d": Action.RIGHT, " ": Action.OPEN, "\n": Action.OPEN, + "f": Action.FLAG, "m": Action.FLAG, "q": Action.QUIT, } @dataclass |