From 621a6d4aa6350dad2ebd0beb1ecae981628366fc Mon Sep 17 00:00:00 2001 From: chrys Date: Sun, 28 Aug 2016 17:21:05 +0200 Subject: [PATCH] fix ncurses apps --- config/settings/settings.conf | 2 +- ...4000-present_char_if_cursor_change_horizontal.py | 4 +++- .../onScreenChanged/65000-char_delete_echo.py | 2 +- src/fenrir-package/screen/linux.py | 13 +++++++------ 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/config/settings/settings.conf b/config/settings/settings.conf index 49de4c77..04e47ac0 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -69,7 +69,7 @@ charEcho=False # echo deleted chars charDeleteEcho=True # echo word after pressing space -wordEcho=True +wordEcho=False # interrupt speech on any keypress interruptOnKeyPress=False diff --git a/src/fenrir-package/commands/onInput/54000-present_char_if_cursor_change_horizontal.py b/src/fenrir-package/commands/onInput/54000-present_char_if_cursor_change_horizontal.py index db97926f..5f5c74f3 100644 --- a/src/fenrir-package/commands/onInput/54000-present_char_if_cursor_change_horizontal.py +++ b/src/fenrir-package/commands/onInput/54000-present_char_if_cursor_change_horizontal.py @@ -10,12 +10,14 @@ class command(): # detect an change on the screen, we just want to cursor arround, so no change should appear if environment['screenData']['newDelta'] != '': return environment + if environment['screenData']['newNegativeDelta'] != '': + return environment # is it a horizontal change? if environment['screenData']['newCursor']['y'] != environment['screenData']['oldCursor']['y'] or\ environment['screenData']['newCursor']['x'] == environment['screenData']['oldCursor']['x']: return environment - if environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']][environment['screenData']['newCursor']['x']].strip(" \t\n") == '': + if environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']][environment['screenData']['newCursor']['x']].strip() == '': pass #environment['runtime']['outputManager'].presentText(environment, "blank",True) else: diff --git a/src/fenrir-package/commands/onScreenChanged/65000-char_delete_echo.py b/src/fenrir-package/commands/onScreenChanged/65000-char_delete_echo.py index e431a75e..0e909c90 100644 --- a/src/fenrir-package/commands/onScreenChanged/65000-char_delete_echo.py +++ b/src/fenrir-package/commands/onScreenChanged/65000-char_delete_echo.py @@ -17,7 +17,7 @@ class command(): return environment # More than just a deletion happend - if environment['screenData']['newDelta'].strip(" \t\n") != '': + if environment['screenData']['newDelta'].strip() != '': if environment['screenData']['newDelta'] != environment['screenData']['oldDelta']: return environment diff --git a/src/fenrir-package/screen/linux.py b/src/fenrir-package/screen/linux.py index 2d2745b1..48a56248 100644 --- a/src/fenrir-package/screen/linux.py +++ b/src/fenrir-package/screen/linux.py @@ -2,7 +2,6 @@ # -*- coding: utf-8 -*- import difflib -import textwrap import time import re @@ -10,8 +9,10 @@ import re class screen(): def __init__(self, device='/dev/vcsa'): self.vcsaDevicePath = device - self.textWrapper = textwrap.TextWrapper() - self.textWrapper.drop_whitespace = False + + def insert_newlines(self, string, every=64): + return '\n'.join(string[i:i+every] for i in range(0, len(string), every)) + def analyzeScreen(self, environment, trigger='updateScreen'): newTTY = '' newContentBytes = b'' @@ -50,10 +51,10 @@ class screen(): # analyze content environment['screenData']['newContentText'] = environment['screenData']['newContentBytes'][4:][::2].decode(screenEncoding, "replace") environment['screenData']['newContentAttrib'] = environment['screenData']['newContentBytes'][5:][::2] - environment['screenData']['newContentText'] = '\n'.join(self.textWrapper.wrap(environment['screenData']['newContentText'], ))[:-2] - + #environment['screenData']['newContentText'] = '\n'.join(self.textWrapper.wrap(environment['screenData']['newContentText'], ))[:-2] + environment['screenData']['newContentText'] = self.insert_newlines(environment['screenData']['newContentText'], environment['screenData']['columns']) + if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']: - self.textWrapper.width = environment['screenData']['columns'] environment['screenData']['oldContentBytes'] = b'' environment['screenData']['oldContentAttrib'] = b'' environment['screenData']['oldContentText'] = ''