From 0c9b73e31749882446a20fae344de86d25d51374 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Wed, 17 Dec 2025 16:52:57 +0100 Subject: [PATCH] Restore ~$foo expansion This reverts commit 52ea5117688388a57e7e7dbdca2b8876fbcdd903 ("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 --- src/wcstringutil.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/wcstringutil.rs b/src/wcstringutil.rs index 3f8bff515..79c751b20 100644 --- a/src/wcstringutil.rs +++ b/src/wcstringutil.rs @@ -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]