From 0a2e9533bd9a53edb6a4d50c88bcfc496b4b03bd Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Fri, 29 Nov 2024 00:15:45 -0500 Subject: [PATCH] Improve marked text over multiple lines, Remove trailing spaces. --- .../commands/commands/copy_marked_to_clipboard.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/fenrirscreenreader/commands/commands/copy_marked_to_clipboard.py b/src/fenrirscreenreader/commands/commands/copy_marked_to_clipboard.py index ae21ffe1..caa37e6b 100644 --- a/src/fenrirscreenreader/commands/commands/copy_marked_to_clipboard.py +++ b/src/fenrirscreenreader/commands/commands/copy_marked_to_clipboard.py @@ -1,12 +1,9 @@ #!/bin/python # -*- coding: utf-8 -*- -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. from fenrirscreenreader.core import debug from fenrirscreenreader.utils import mark_utils - class command(): def __init__(self): pass @@ -40,17 +37,17 @@ class command(): # First line (from start mark to end of line) firstLine = screenLines[startY] startX = min(startMark['x'], len(firstLine)) - result.append(firstLine[startX:]) + result.append(firstLine[startX:].rstrip()) # Middle lines (complete lines) for lineNum in range(startY + 1, endY): - result.append(screenLines[lineNum]) + result.append(screenLines[lineNum].rstrip()) # Last line (from start to end mark) if endY > startY: lastLine = screenLines[endY] endX = min(endMark['x'], len(lastLine)) + 1 - result.append(lastLine[:endX]) + result.append(lastLine[:endX].rstrip()) return '\n'.join(result)