make navigation always verbose
This commit is contained in:
parent
fe2070c300
commit
b37b747ab1
@ -22,7 +22,9 @@ class command():
|
|||||||
# 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
|
||||||
|
# is naviation?
|
||||||
|
if self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'] != 1:
|
||||||
|
return
|
||||||
# just when cursor move worddetection is needed
|
# just when cursor move worddetection is needed
|
||||||
if not self.env['runtime']['cursorManager'].isCursorHorizontalMove():
|
if not self.env['runtime']['cursorManager'].isCursorHorizontalMove():
|
||||||
return
|
return
|
||||||
@ -41,19 +43,10 @@ class command():
|
|||||||
# is there a word?
|
# is there a word?
|
||||||
if currWord == '':
|
if currWord == '':
|
||||||
return
|
return
|
||||||
|
|
||||||
# navigate by word (i.e. CTRL + Arrow left/right)
|
|
||||||
if abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) > 1:
|
|
||||||
# at the start of a word
|
|
||||||
if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \
|
|
||||||
(self.env['screen']['newCursor']['x'] != x):
|
|
||||||
return
|
|
||||||
|
|
||||||
# navigate by char (left/ right)
|
|
||||||
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
|
||||||
|
# at the end of a word
|
||||||
if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \
|
if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \
|
||||||
(x + len(currWord) != self.env['screen']['newCursor']['x']-1):
|
(x + len(currWord) != self.env['screen']['newCursor']['x']-1):
|
||||||
return
|
return
|
@ -0,0 +1,54 @@
|
|||||||
|
#!/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Fenrir TTY screen reader
|
||||||
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
|
from core import debug
|
||||||
|
from utils import word_utils
|
||||||
|
import string
|
||||||
|
|
||||||
|
class command():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def initialize(self, environment):
|
||||||
|
self.env = environment
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
||||||
|
def getDescription(self):
|
||||||
|
return 'No Description found'
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
# is navigation?
|
||||||
|
if not abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) > 1:
|
||||||
|
return
|
||||||
|
|
||||||
|
# just when cursor move worddetection is needed
|
||||||
|
if not self.env['runtime']['cursorManager'].isCursorHorizontalMove():
|
||||||
|
return
|
||||||
|
# for now no new line
|
||||||
|
if self.env['runtime']['cursorManager'].isCursorVerticalMove():
|
||||||
|
return
|
||||||
|
# currently writing
|
||||||
|
if self.env['runtime']['screenManager'].isDelta():
|
||||||
|
return
|
||||||
|
|
||||||
|
# get the word
|
||||||
|
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)
|
||||||
|
|
||||||
|
# is there a word?
|
||||||
|
if currWord == '':
|
||||||
|
return
|
||||||
|
|
||||||
|
# at the start of a word
|
||||||
|
if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \
|
||||||
|
(self.env['screen']['newCursor']['x'] != x):
|
||||||
|
return
|
||||||
|
|
||||||
|
self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False)
|
||||||
|
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
||||||
|
|
Loading…
Reference in New Issue
Block a user