Skip to content

Commit

Permalink
Fix selecting a changed file in global search (#5639)
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalkuthe authored Jan 23, 2023
1 parent 17acadb commit 361a834
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()));

Expand Down

0 comments on commit 361a834

Please sign in to comment.