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'
def run(self):
# first place could not be the end of a word
if self.env['screen']['newCursor']['x'] == 0:
return
# is it enabled?
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'):
return
@ -36,11 +33,21 @@ class command():
newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']]
x, y, currWord, endOfScreen, lineBreak = \
word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent)
# currently writing
if self.env['runtime']['screenManager'].isDelta():
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:
# at the end of a word
# at the end of a word
if not newContent[self.env['screen']['newCursor']['x']].isspace():
return
if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \