This commit is contained in:
redfast00 2019-08-22 20:37:42 +02:00
parent 2cdcd8832a
commit abfbea97c2
No known key found for this signature in database
GPG key ID: 5946E0E34FD0553C

View file

@ -7,7 +7,6 @@ import base64
NULL_CHAR = chr(0) NULL_CHAR = chr(0)
last_c = None
colors = { colors = {
"Z": ["a", "a"], "Z": ["a", "a"],
@ -30,11 +29,7 @@ def release_keys():
def printchar(c): def printchar(c):
print(c) if c.islower():
if last_c == '§':
print('changing color')
change_color(c)
elif c.islower():
write_report(NULL_CHAR*2+chr(4 + ord(c) - ord('a'))+NULL_CHAR*5) write_report(NULL_CHAR*2+chr(4 + ord(c) - ord('a'))+NULL_CHAR*5)
elif c.isupper(): elif c.isupper():
write_report(chr(32)+NULL_CHAR+chr(4 + ord(c) - ord('A'))+NULL_CHAR*5) write_report(chr(32)+NULL_CHAR+chr(4 + ord(c) - ord('A'))+NULL_CHAR*5)
@ -44,7 +39,7 @@ def printchar(c):
write_report(NULL_CHAR*2+chr(44)+NULL_CHAR*5) write_report(NULL_CHAR*2+chr(44)+NULL_CHAR*5)
elif c == '\n': elif c == '\n':
write_report(NULL_CHAR*2+chr(40)+NULL_CHAR*5) write_report(NULL_CHAR*2+chr(40)+NULL_CHAR*5)
elif c != '§': else:
write_report(chr(32)+NULL_CHAR+chr(0x38)+NULL_CHAR*5) write_report(chr(32)+NULL_CHAR+chr(0x38)+NULL_CHAR*5)
release_keys() release_keys()
@ -59,13 +54,17 @@ def change_color(c: str):
write_report(NULL_CHAR*2+chr(4 + ord(colors[c][1]) - ord('a'))+NULL_CHAR*5) write_report(NULL_CHAR*2+chr(4 + ord(colors[c][1]) - ord('a'))+NULL_CHAR*5)
else: else:
write_report(chr(32)+NULL_CHAR+chr(0x38)+NULL_CHAR*5) write_report(chr(32)+NULL_CHAR+chr(0x38)+NULL_CHAR*5)
release_keys()
def printstring(s): def printstring(s):
last_c = ''
for c in s: for c in s:
if last_c == '§':
change_color(c)
else:
printchar(c) printchar(c)
last_c = c last_c = c
print('last_c=' + str(last_c == '§'))
def reset_color(): def reset_color():