From 116729520bd0fb40735fc0541704f1c338bf7ab5 Mon Sep 17 00:00:00 2001 From: chrys Date: Thu, 31 May 2018 12:28:11 +0200 Subject: [PATCH] make 2, for key repeat work --- config/keyboard/pty.conf | 2 +- src/fenrirscreenreader/core/byteManager.py | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/config/keyboard/pty.conf b/config/keyboard/pty.conf index 484d14c4..ea435a74 100644 --- a/config/keyboard/pty.conf +++ b/config/keyboard/pty.conf @@ -1,7 +1,7 @@ # f1 - fenrir help ^[OP=toggle_tutorial_mode # double tap control+end read attributes -^[[1;5F^[[1;5F=attribute_cursor +2,^[[1;5F=attribute_cursor # escape - stop speech ^[=shut_up # context menu key - stop speech diff --git a/src/fenrirscreenreader/core/byteManager.py b/src/fenrirscreenreader/core/byteManager.py index c51ccf00..d4e8b986 100644 --- a/src/fenrirscreenreader/core/byteManager.py +++ b/src/fenrirscreenreader/core/byteManager.py @@ -102,7 +102,20 @@ class byteManager(): if line.count("=") != 1: continue Values = line.split('=') - shortcut = bytes(Values[0],'UTF-8') + cleanShortcut = bytes(Values[0],'UTF-8') + repeat = 1 + if len(cleanShortcut) > 2: + if chr(cleanShortcut[1]) == ',': + try: + repeat = int(chr(cleanShortcut[0])) + cleanShortcut = cleanShortcut[2:] + except: + repeat = 1 + cleanShortcut = cleanShortcut + print(repeat,cleanShortcut) + shortcut = b'' + for i in range(repeat): + shortcut += cleanShortcut commandName = Values[1].upper() self.env['bindings'][shortcut] = commandName self.env['runtime']['debug'].writeDebugOut("Byte Shortcut: "+ str(shortcut) + ' command:' +commandName ,debug.debugLevel.INFO, onAnyLevel=True)