improve navigation

This commit is contained in:
chrys 2017-09-26 23:51:07 +02:00
parent 52a8342a3c
commit d745042839
3 changed files with 14 additions and 4 deletions

View File

@ -33,6 +33,15 @@ class command():
# is it a horizontal change? # is it a horizontal change?
if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): if not self.env['runtime']['cursorManager'].isCursorHorizontalMove():
return return
# echo word insteed of char
if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'):
if abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) != 1:
# 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)
if self.env['screen']['newCursor']['x'] == x:
return
x, y, currChar = char_utils.getCurrentChar(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText']) x, y, currChar = char_utils.getCurrentChar(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText'])
if not currChar.isspace(): if not currChar.isspace():
self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)

View File

@ -6,6 +6,7 @@
from core import debug from core import debug
from utils import line_utils from utils import line_utils
from utils import word_utils
class command(): class command():
def __init__(self): def __init__(self):

View File

@ -42,14 +42,14 @@ class command():
if currWord == '': if currWord == '':
return return
# navigate prev word # navigate by word (i.e. CTRL + Arrow left/right)
if self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x'] > 1: if abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) > 1:
# at the start of a word # at the start of a word
if newContent[self.env['screen']['newCursor']['x']].isspace(): if newContent[self.env['screen']['newCursor']['x']].isspace():
return return
if self.env['screen']['newCursor']['x'] != x: if self.env['screen']['newCursor']['x'] != x:
return return
# navigate next word # navigate by char (left/ right)
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():