File: output.py

package info (click to toggle)
plover 5.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 14,356 kB
  • sloc: python: 21,589; sh: 682; ansic: 25; makefile: 11
file content (19 lines) | stat: -rw-r--r-- 509 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class CaptureOutput:
    def __init__(self):
        self.instructions = []
        self.text = ""

    def send_backspaces(self, n):
        assert n <= len(self.text)
        self.text = self.text[:-n]
        self.instructions.append(("b", n))

    def send_string(self, s):
        self.text += s
        self.instructions.append(("s", s))

    def send_key_combination(self, c):
        self.instructions.append(("c", c))

    def send_engine_command(self, c):
        self.instructions.append(("e", c))