Improve marked text over multiple lines, Remove trailing spaces.
This commit is contained in:
		| @@ -1,12 +1,9 @@ | |||||||
| #!/bin/python | #!/bin/python | ||||||
| # -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||||
|  |  | ||||||
| # Fenrir TTY screen reader |  | ||||||
| # By Chrys, Storm Dragon, and contributers. |  | ||||||
|  |  | ||||||
| from fenrirscreenreader.core import debug | from fenrirscreenreader.core import debug | ||||||
| from fenrirscreenreader.utils import mark_utils | from fenrirscreenreader.utils import mark_utils | ||||||
|  |  | ||||||
| class command(): | class command(): | ||||||
|     def __init__(self): |     def __init__(self): | ||||||
|         pass |         pass | ||||||
| @@ -40,17 +37,17 @@ class command(): | |||||||
|         # First line (from start mark to end of line) |         # First line (from start mark to end of line) | ||||||
|         firstLine = screenLines[startY] |         firstLine = screenLines[startY] | ||||||
|         startX = min(startMark['x'], len(firstLine)) |         startX = min(startMark['x'], len(firstLine)) | ||||||
|         result.append(firstLine[startX:]) |         result.append(firstLine[startX:].rstrip()) | ||||||
|          |          | ||||||
|         # Middle lines (complete lines) |         # Middle lines (complete lines) | ||||||
|         for lineNum in range(startY + 1, endY): |         for lineNum in range(startY + 1, endY): | ||||||
|             result.append(screenLines[lineNum]) |             result.append(screenLines[lineNum].rstrip()) | ||||||
|              |              | ||||||
|         # Last line (from start to end mark) |         # Last line (from start to end mark) | ||||||
|         if endY > startY: |         if endY > startY: | ||||||
|             lastLine = screenLines[endY] |             lastLine = screenLines[endY] | ||||||
|             endX = min(endMark['x'], len(lastLine)) + 1 |             endX = min(endMark['x'], len(lastLine)) + 1 | ||||||
|             result.append(lastLine[:endX]) |             result.append(lastLine[:endX].rstrip()) | ||||||
|              |              | ||||||
|         return '\n'.join(result) |         return '\n'.join(result) | ||||||
|      |      | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user