diff --git a/config/sound/default/soundicons.conf b/config/sound/default/soundicons.conf index d65fbec9..830ccb13 100644 --- a/config/sound/default/soundicons.conf +++ b/config/sound/default/soundicons.conf @@ -13,6 +13,8 @@ ChangeTTY='ChangeTTY.wav' StartOfLine='StartOfLine.wav' # Is the last position of the Line EndOfLine='EndOfLine.wav' +# barrier was detected +BarrierFound='barrier.wav' # the Line is empty EmptyLine='EmptyLine.wav' # Is the first line on the screen. diff --git a/config/sound/template/soundicons.conf b/config/sound/template/soundicons.conf index e9a5fc02..e5039970 100644 --- a/config/sound/template/soundicons.conf +++ b/config/sound/template/soundicons.conf @@ -13,6 +13,8 @@ ChangeTTY='' StartOfLine='' # Is the last position of the Line EndOfLine='' +# barrier was detected +BarrierFound='' # the Line is empty EmptyLine='' # Is the first line on the screen. diff --git a/src/fenrirscreenreader/commands/onCursorChange/55000-present_line_if_cursor_change_vertical.py b/src/fenrirscreenreader/commands/onCursorChange/55000-present_line_if_cursor_change_vertical.py index 9193bb11..b42da4d6 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/55000-present_line_if_cursor_change_vertical.py +++ b/src/fenrirscreenreader/commands/onCursorChange/55000-present_line_if_cursor_change_vertical.py @@ -48,7 +48,7 @@ class command(): # barrier sayLine = currLine if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'barrier'): - sayLine = self.env['runtime']['textManager'].getBarrierText(sayLine, self.env['screen']['newCursor']['x']) + sayLine = self.env['runtime']['barrierManager'].handleLineBarrier(sayLine, self.env['screen']['newCursor']['x']) # output self.env['runtime']['outputManager'].presentText(sayLine, interrupt=doInterrupt, flush=False) self.lastIdent = currIdent diff --git a/src/fenrirscreenreader/commands/onScreenUpdate/70000-incoming.py b/src/fenrirscreenreader/commands/onScreenUpdate/70000-incoming.py index 38c55d7b..cc2bc393 100644 --- a/src/fenrirscreenreader/commands/onScreenUpdate/70000-incoming.py +++ b/src/fenrirscreenreader/commands/onScreenUpdate/70000-incoming.py @@ -27,13 +27,12 @@ class command(): #if len(self.env['screen']['newDelta'].strip(' \n\t')) <= 1: xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) yMove = abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y']) + if (xMove >= 1) and xMove == len(self.env['screen']['newDelta']): # if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2: if not '\n' in self.env['screen']['newDelta']: return - #if yMove == 1: - # if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2: - # return + #print(xMove, yMove, len(self.env['screen']['newDelta']), len(self.env['screen']['newNegativeDelta'])) self.env['runtime']['outputManager'].presentText(self.env['screen']['newDelta'], interrupt=False, flush=False) def setCallback(self, callback): diff --git a/src/fenrirscreenreader/core/screenManager.py b/src/fenrirscreenreader/core/screenManager.py index 28a97774..b39608d9 100644 --- a/src/fenrirscreenreader/core/screenManager.py +++ b/src/fenrirscreenreader/core/screenManager.py @@ -158,18 +158,16 @@ class screenManager(): newScreenText = self.env['screen']['newContentText'][cursorLineStartOffset:cursorLineEndOffset] #newScreenText = re.sub(' +',' ',newScreenText) diff = self.differ.compare(oldScreenText, newScreenText) - #diff = difflib.ndiff(oldScreenText, newScreenText) diffList = list(diff) + typing = True tempNewDelta = ''.join(x[2:] for x in diffList if x[0] == '+') if tempNewDelta.strip() != '': if tempNewDelta != ''.join(newScreenText[self.env['screen']['oldCursor']['x']:self.env['screen']['newCursor']['x']].rstrip()): - diffList = ['+ ' + self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']]] - typing = True + diffList = ['+ ' + self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] +'\n'] + typing = False else: diff = self.differ.compare(oldScreenText.split('\n'),\ newScreenText.split('\n')) - #diff = difflib.ndiff( oldScreenText.split('\n'),\ - # newScreenText.split('\n')) diffList = list(diff) if not typing: diff --git a/src/fenrirscreenreader/core/settingsManager.py b/src/fenrirscreenreader/core/settingsManager.py index bab8a94b..87e6c9e9 100644 --- a/src/fenrirscreenreader/core/settingsManager.py +++ b/src/fenrirscreenreader/core/settingsManager.py @@ -25,6 +25,7 @@ from fenrirscreenreader.core import textManager from fenrirscreenreader.core import tableManager from fenrirscreenreader.core import byteManager from fenrirscreenreader.core import attributeManager +from fenrirscreenreader.core import barrierManager from fenrirscreenreader.core import environment from fenrirscreenreader.core.settingsData import settingsData from fenrirscreenreader.core import debug @@ -326,7 +327,9 @@ class settingsManager(): environment['runtime']['textManager'] = textManager.textManager() environment['runtime']['textManager'].initialize(environment) environment['runtime']['tableManager'] = tableManager.tableManager() - environment['runtime']['tableManager'].initialize(environment) + environment['runtime']['tableManager'].initialize(environment) + environment['runtime']['barrierManager'] = barrierManager.barrierManager() + environment['runtime']['barrierManager'].initialize(environment) environment['runtime']['debug'].writeDebugOut('\/-------environment-------\/',debug.debugLevel.INFO, onAnyLevel=True) environment['runtime']['debug'].writeDebugOut(str(environment), debug.debugLevel.INFO, onAnyLevel=True) diff --git a/src/fenrirscreenreader/core/textManager.py b/src/fenrirscreenreader/core/textManager.py index 5126b7be..b68aad34 100644 --- a/src/fenrirscreenreader/core/textManager.py +++ b/src/fenrirscreenreader/core/textManager.py @@ -15,27 +15,6 @@ class textManager(): self.env = environment def shutdown(self): pass - def hasBarrier(self, start, end): - # check for corners here - return True - def getBarrierText(self, line, xCursor): - offset = xCursor - # is the cursor at the begin or end of an entry: - if line[:offset + 1].count('│') > line[offset + 1:].count('│'): - offset = xCursor - 1 - start = line[:offset + 1].rfind('│') + 1 - end = line[offset + 1:].find('│') - if start == end: - return line - if start == -1: - return line - if end == -1: - return line - else: - end += offset + 1 - if not self.hasBarrier(start, end): - return line - return line[start:end] def replaceHeadLines(self, text): # fast len check for bigger typing echo