Fixed an off by one error when marking text.

This commit is contained in:
Storm Dragon 2024-11-20 11:47:17 -05:00
parent 56f403b0b9
commit dda9d5e4e7

View File

@ -31,7 +31,7 @@ class command():
if startY == endY: if startY == endY:
line = screenLines[startY] line = screenLines[startY]
startX = min(startMark['x'], len(line)) startX = min(startMark['x'], len(line))
endX = min(endMark['x'], len(line)) endX = min(endMark['x'], len(line)) + 1
return line[startX:endX] return line[startX:endX]
# Handle multi-line selection # Handle multi-line selection
@ -49,7 +49,7 @@ class command():
# 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)) endX = min(endMark['x'], len(lastLine)) + 1
result.append(lastLine[:endX]) result.append(lastLine[:endX])
return '\n'.join(result) return '\n'.join(result)