Restore ~$foo expansion

This reverts commit 52ea511768 ("cleanup: remove useless `INTERNAL_SEPARATOR` handling").

I don't know how to test this given that we don't know what users exist (maybe "root"?).

Fixes #12175
This commit is contained in:
Fabian Boehm
2025-12-17 16:52:57 +01:00
parent b29a85f45f
commit 0c9b73e317

View File

@@ -1,6 +1,7 @@
//! Helper functions for working with wcstring.
use crate::common::{get_ellipsis_char, get_ellipsis_str};
use crate::expand::INTERNAL_SEPARATOR;
use crate::fallback::{fish_wcwidth, wcscasecmp, wcscasecmp_fuzzy};
use crate::wchar::{decode_byte_from_char, prelude::*};
@@ -321,6 +322,11 @@ pub fn wcs2bytes_callback(input: &wstr, mut func: impl FnMut(&[u8]) -> bool) ->
let mut converted = [0_u8; 4];
for c in input.chars() {
if c == INTERNAL_SEPARATOR {
// do nothing, this is important for ~$user handling
continue;
}
let bytes = if let Some(byte) = decode_byte_from_char(c) {
converted[0] = byte;
&converted[..=0]