aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorPascal Kuthe2023-01-23 17:18:44 +0000
committerGitHub2023-01-23 17:18:44 +0000
commit361a8344866841799199e362285b119960151eff (patch)
tree214e684116b895c8fc1d10c6b52268e0dee19e48 /helix-term/src
parent17acadb305bebfef094e4fcc9ba1e6fda6159c3b (diff)
Fix selecting a changed file in global search (#5639)
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index e773a2c7..e7091401 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -2003,6 +2003,10 @@ fn global_search(cx: &mut Context) {
let line_num = *line_num;
let (view, doc) = current!(cx.editor);
let text = doc.text();
+ if line_num >= text.len_lines() {
+ cx.editor.set_error("The line you jumped to does not exist anymore because the file has changed.");
+ return;
+ }
let start = text.line_to_char(line_num);
let end = text.line_to_char((line_num + 1).min(text.len_lines()));