Skip to content

Commit 4870904

Browse files
committed
fix: over-pane distance calculation
1 parent 785f08c commit 4870904

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

easymotion.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ def assign_hints_by_distance(matches, cursor_y, cursor_x):
416416
matches_with_dist = []
417417
for match in matches:
418418
pane, line_num, col = match
419-
dist = (line_num - cursor_y)**2 + (col - cursor_x)**2
419+
dist = (pane.start_y + line_num - cursor_y)**2 + (pane.start_x + col - cursor_x)**2
420420
matches_with_dist.append((dist, match))
421421

422422
matches_with_dist.sort(key=lambda x: x[0]) # Sort by distance
@@ -639,8 +639,8 @@ def main(screen: Screen):
639639
return
640640

641641
# Get cursor position from current pane
642-
cursor_y = current_pane.cursor_y
643-
cursor_x = current_pane.cursor_x
642+
cursor_y = current_pane.start_y + current_pane.cursor_y
643+
cursor_x = current_pane.start_x + current_pane.cursor_x
644644
logging.debug(f"Cursor position: {current_pane.pane_id}, {
645645
cursor_y}, {cursor_x}")
646646

0 commit comments

Comments
 (0)