Fix panic in `goto_word` when `editor.jump-label-alphabet` is empty (#13863)

pull/13510/merge
Tino 2025-07-01 17:06:54 +03:00 committed by GitHub
parent 6081a5df81
commit 6a090471a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -6728,6 +6728,10 @@ fn jump_to_word(cx: &mut Context, behaviour: Movement) {
// Calculate the jump candidates: ranges for any visible words with two or // Calculate the jump candidates: ranges for any visible words with two or
// more characters. // more characters.
let alphabet = &cx.editor.config().jump_label_alphabet; let alphabet = &cx.editor.config().jump_label_alphabet;
if alphabet.is_empty() {
return;
}
let jump_label_limit = alphabet.len() * alphabet.len(); let jump_label_limit = alphabet.len() * alphabet.len();
let mut words = Vec::with_capacity(jump_label_limit); let mut words = Vec::with_capacity(jump_label_limit);
let (view, doc) = current_ref!(cx.editor); let (view, doc) = current_ref!(cx.editor);