Fix panic on paste from blackhole register (#4497)

The sequence "_y"_p panics because the blackhole register contains an
empty values vec. This causes a panic when pasting since it unwraps
a `slice::last`.
pull/3696/head
Michael Davis 2 years ago committed by GitHub
parent d6323b7cbc
commit 3814987298
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3447,7 +3447,12 @@ enum Paste {
}
fn paste_impl(values: &[String], doc: &mut Document, view: &mut View, action: Paste, count: usize) {
if values.is_empty() {
return;
}
let repeat = std::iter::repeat(
// `values` is asserted to have at least one entry above.
values
.last()
.map(|value| Tendril::from(value.repeat(count)))

Loading…
Cancel
Save