mirror of https://github.com/helix-editor/helix
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
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) {
|
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(
|
let repeat = std::iter::repeat(
|
||||||
|
// `values` is asserted to have at least one entry above.
|
||||||
values
|
values
|
||||||
.last()
|
.last()
|
||||||
.map(|value| Tendril::from(value.repeat(count)))
|
.map(|value| Tendril::from(value.repeat(count)))
|
||||||
|
|
Loading…
Reference in New Issue