on master help sign in
fix panic in inlay hint computation when view anchor is out of bounds (#6883)
commit8f1671eaaa6c917c131567dec1dc7dce628e548b authorPascal Kuthe <pascal.kuthe@semimod.de> dateThu 27 Apr 2023, 02:38 (4 years ago) parent903bdaa
1 file changed+2−1
helix-term/src/commands/lsp.rs+2−1
helix-term/src/commands/lsp.rs+2−1
@@ -1513,7 +1513,8 @@ fn compute_inlay_hints_for_view(
15131513 // than computing all the hints for the full file (which could be dozens of time
15141514 // longer than the view is).
15151515 let view_height = view.inner_height();
1516− let first_visible_line = doc_text.char_to_line(view.offset.anchor);
1516+ let first_visible_line =
1517+ doc_text.char_to_line(view.offset.anchor.min(doc_text.len_chars()));
15171518 let first_line = first_visible_line.saturating_sub(view_height);
15181519 let last_line = first_visible_line
15191520 .saturating_add(view_height.saturating_mul(2))