aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorPascal Kuthe2023-04-27 00:38:20 +0000
committerGitHub2023-04-27 00:38:20 +0000
commit8f1671eaaa6c917c131567dec1dc7dce628e548b (patch)
treeafe520c91166510e2c9b2065dc394bb0b632d3b7 /helix-term
parent903bdaae875fa45b6371ace14fc5267cf2e228cc (diff)
fix panic in inlay hint computation when view anchor is out of bounds (#6883)
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands/lsp.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs
index be8ae02a..b5d1d337 100644
--- a/helix-term/src/commands/lsp.rs
+++ b/helix-term/src/commands/lsp.rs
@@ -1513,7 +1513,8 @@ fn compute_inlay_hints_for_view(
// than computing all the hints for the full file (which could be dozens of time
// longer than the view is).
let view_height = view.inner_height();
- let first_visible_line = doc_text.char_to_line(view.offset.anchor);
+ let first_visible_line =
+ doc_text.char_to_line(view.offset.anchor.min(doc_text.len_chars()));
let first_line = first_visible_line.saturating_sub(view_height);
let last_line = first_visible_line
.saturating_add(view_height.saturating_mul(2))