Skip to content

Commit

Permalink
fix(lsp): goto_line_backward abs_pos
Browse files Browse the repository at this point in the history
fix book-keeping of [abs_pos] in [String_zipper.goto_line_backward]
  • Loading branch information
emilienlemaire authored and rgrinberg committed May 17, 2024
1 parent e3b97b6 commit e36d472
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lsp/src/string_zipper.ml
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ let drop_until from until =
| [] -> empty
| current :: left ->
let rel_pos = Substring.length current in
let abs_pos = from.rel_pos + rel_pos in
let abs_pos = from.abs_pos + rel_pos in
{ from with right; left; current; rel_pos; abs_pos })

let add_buffer_between b start stop =
Expand Down
2 changes: 1 addition & 1 deletion lsp/test/string_zipper_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@ let%expect_test "drop_until bug" =
"foo\nbar\n|" |}];
printfn "abs_pos: %d" (String_zipper.Private.reflect t).abs_pos;
[%expect {|
abs_pos: 16 |}]
abs_pos: 8 |}]

0 comments on commit e36d472

Please sign in to comment.