on master help sign in
Fix selecting a changed file in global search (#5639)
commit361a8344866841799199e362285b119960151eff authorPascal Kuthe <pascal.kuthe@semimod.de> dateMon 23 Jan 2023, 18:18 (4 years ago) parent17acadb
1 file changed+4
helix-term/src/commands.rs+4
helix-term/src/commands.rs+4
@@ -2003,6 +2003,10 @@ fn global_search(cx: &mut Context) {
20032003 let line_num = *line_num;
20042004 let (view, doc) = current!(cx.editor);
20052005 let text = doc.text();
2006+ if line_num >= text.len_lines() {
2007+ cx.editor.set_error("The line you jumped to does not exist anymore because the file has changed.");
2008+ return;
2009+ }
20062010 let start = text.line_to_char(line_num);
20072011 let end = text.line_to_char((line_num + 1).min(text.len_lines()));
20082012