on master help sign in
fix panic in inlay hint computation when view anchor is out of bounds (#6883)
8f1671ePascal Kuthe
helix-term/src/commands/lsp.rs+2−1
@@ -1513,7 +1513,8 @@ fn compute_inlay_hints_for_view(
1513 // than computing all the hints for the full file (which could be dozens of time
1513 // than computing all the hints for the full file (which could be dozens of time
1514 // longer than the view is).
1514 // longer than the view is).
1515 let view_height = view.inner_height();
1515 let view_height = view.inner_height();
1516+ let first_visible_line =
1516− let first_visible_line = doc_text.char_to_line(view.offset.anchor);
1517+ doc_text.char_to_line(view.offset.anchor.min(doc_text.len_chars()));
1517 let first_line = first_visible_line.saturating_sub(view_height);
1518 let first_line = first_visible_line.saturating_sub(view_height);
1518 let last_line = first_visible_line
1519 let last_line = first_visible_line
1519 .saturating_add(view_height.saturating_mul(2))
1520 .saturating_add(view_height.saturating_mul(2))