Skip to content

Commit

Permalink
selection fix
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Jan 10, 2025
1 parent 7657a9e commit bc651bb
Show file tree
Hide file tree
Showing 2 changed files with 157 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/textual/_compositor.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,12 +920,16 @@ def get_widget_and_offset_at(
offset_x, offset_y = style.meta["offset"]
offset_x2 = offset_x + len(segment.text)

if x <= end and x >= start:
first, _ = segment.split_cells(x - start)
if x < end and x >= start:
if x == end - 1:
segment_offset = len(segment.text)
else:
first, _ = segment.split_cells(x - start)
segment_offset = len(first.text)
return widget, (
None
if offset_y is None
else Offset(offset_x + len(first.text), offset_y)
else Offset(offset_x + segment_offset, offset_y)
)
start = end

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bc651bb

Please sign in to comment.