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`.
This commit is contained in:
parent
d6323b7cbc
commit
3814987298
@ -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…
Reference in New Issue
Block a user