From d39db88efd5e8e629a70e5e64e060a8df00af3bf Mon Sep 17 00:00:00 2001 From: chrys Date: Sat, 1 Oct 2016 03:55:30 +0200 Subject: [PATCH] fix irssi reading with empty screen --- src/fenrir-package/screenDriver/linux.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/fenrir-package/screenDriver/linux.py b/src/fenrir-package/screenDriver/linux.py index 65819380..43d97ae3 100644 --- a/src/fenrir-package/screenDriver/linux.py +++ b/src/fenrir-package/screenDriver/linux.py @@ -124,14 +124,15 @@ class driver(): newScreenText != '': self.env['screenData']['newDelta'] = newScreenText else: - diffStart = 0 + cursorLineStart = self.env['screenData']['newCursor']['y'] * self.env['screenData']['columns'] + self.env['screenData']['newCursor']['y'] + cursorLineEnd = cursorLineStart + self.env['screenData']['columns'] if self.env['screenData']['oldCursor']['x'] != self.env['screenData']['newCursor']['x'] and \ self.env['screenData']['oldCursor']['y'] == self.env['screenData']['newCursor']['y'] and \ - self.env['screenData']['newContentText'][:self.env['screenData']['newCursor']['y']] == self.env['screenData']['oldContentText'][:self.env['screenData']['newCursor']['y']]: - diffStart = self.env['screenData']['newCursor']['y'] * self.env['screenData']['columns'] + self.env['screenData']['newCursor']['y'] - oldScreenText = self.env['screenData']['oldContentText'][diffStart:diffStart + self.env['screenData']['columns']] + self.env['screenData']['newContentText'][:cursorLineStart] == self.env['screenData']['oldContentText'][:cursorLineStart]: + + oldScreenText = self.env['screenData']['oldContentText'][cursorLineStart:cursorLineEnd] oldScreenText = re.sub(' +',' ',oldScreenText) - newScreenText = self.env['screenData']['newContentText'][diffStart:diffStart + self.env['screenData']['columns']] + newScreenText = self.env['screenData']['newContentText'][cursorLineStart:cursorLineEnd] newScreenText = re.sub(' +',' ',newScreenText) diff = difflib.ndiff(oldScreenText, newScreenText) else: