Skip to content

Commit

Permalink
Fix #1689
Browse files Browse the repository at this point in the history
  • Loading branch information
ncik-roberts committed Oct 5, 2023
1 parent 1c0f4a1 commit 0afd97a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ merlin NEXT_VERSION

+ editor modes
- vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)
+ merlin binary
- Fix a follow-up issue to the preference of non-ghost nodes introduced in #1660 (#1690, fixes #1689)

merlin 4.12
===========
Expand Down
12 changes: 7 additions & 5 deletions src/kernel/mbrowse.ml
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,13 @@ let compare_locations pos l1 l2 =
Location_aux.compare_pos pos l2
with
| 0, 0 ->
(* Cursor inside both locations: favor closer to the end *)
if l1.Location.loc_ghost then 1
else if l2.Location.loc_ghost then -1
else
Lexing.compare_pos l1.Location.loc_end l2.Location.loc_end
(* Cursor inside both locations: favor non-ghost closer to the end *)
begin match l1.Location.loc_ghost, l2.Location.loc_ghost with
| true, false -> 1
| false, true -> -1
| _ ->
Lexing.compare_pos l1.Location.loc_end l2.Location.loc_end
end
(* Cursor inside one location: it has priority *)
| 0, _ -> t1_first
| _, 0 -> t2_first
Expand Down

0 comments on commit 0afd97a

Please sign in to comment.