speak word when navigating cursor by word with CTRL + B

This commit is contained in:
chrys 2017-09-26 23:19:48 +02:00
parent 6c92cb0db0
commit c07ac6ca3d

View File

@ -19,9 +19,6 @@ class command():
return 'No Description found' return 'No Description found'
def run(self): def run(self):
# first place could not be the end of a word
if self.env['screen']['newCursor']['x'] == 0:
return
# is it enabled? # is it enabled?
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'): if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'):
return return
@ -36,11 +33,21 @@ class command():
newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']]
x, y, currWord, endOfScreen, lineBreak = \ x, y, currWord, endOfScreen, lineBreak = \
word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent)
# currently writing # currently writing
if self.env['runtime']['screenManager'].isDelta(): if self.env['runtime']['screenManager'].isDelta():
return return
# navigate prev word
if self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x'] > 1:
# at the end of a word
if newContent[self.env['screen']['newCursor']['x']].isspace():
return
if self.env['screen']['newCursor']['x'] != x:
return
# next word
else: else:
# at the end of a word # at the end of a word
if not newContent[self.env['screen']['newCursor']['x']].isspace(): if not newContent[self.env['screen']['newCursor']['x']].isspace():
return return
if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \ if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \