Improve marked text over multiple lines, Remove trailing spaces.

This commit is contained in:
Storm Dragon 2024-11-29 00:15:45 -05:00
parent 1649f18a8f
commit 0a2e9533bd

View File

@ -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)