Perform Process Expansions Output Handling Without Allocating
When process expansions aren't quoted, we split the output by whitespace and then join them together with spaces. We need a better solution that doesn't involve allocations. Example code:
// TODO: Complete this so that we don't need any heap allocations.
// All that we need is to shift bytes to the left when extra spaces are found,
// and to disallow whitespace at the beginning and end of the string.
unsafe {
let bytes: &mut [u8] = output.as_bytes_mut();
bytes.iter_mut()
.filter(|b| **b == b'\n' || **b == b'\t')
.for_each(|b| *b = b' ');
slice(current, str::from_utf8_unchecked(&bytes), selection)
}