1
0
Fork 0
mirror of https://github.com/helix-editor/helix synced 2024-06-01 07:46:05 +02:00

Fix selecting a changed file in global search (#5639)

This commit is contained in:
Pascal Kuthe 2023-01-23 18:18:44 +01:00 committed by GitHub
parent 17acadb305
commit 361a834486
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2003,6 +2003,10 @@ fn format(&self, current_path: &Self::Data) -> Row {
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()));