@@ -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))