mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-31 17:07:27 +08:00
Collapse duplicate ENCODE_DIRECT_BASE and ENCODE_DIRECT_END
Credit to @Xiretza for spotting this.
This commit is contained in:
parent
ba7785856e
commit
b0a3e14832
@ -53,9 +53,9 @@ use num_traits;
|
||||
use std::result::Result;
|
||||
|
||||
use crate::builtins::shared::{io_streams_t, STATUS_CMD_ERROR, STATUS_CMD_OK, STATUS_INVALID_ARGS};
|
||||
use crate::common::ENCODE_DIRECT_BASE;
|
||||
use crate::ffi::parser_t;
|
||||
use crate::locale::{get_numeric_locale, Locale};
|
||||
use crate::wchar::ENCODE_DIRECT_BASE;
|
||||
use crate::wchar::{wstr, WExt, WString, L};
|
||||
use crate::wutil::errors::Error;
|
||||
use crate::wutil::gettext::{wgettext, wgettext_fmt};
|
||||
@ -632,7 +632,7 @@ impl<'a> builtin_printf_state_t<'a> {
|
||||
self.fatal_error(wgettext!("missing hexadecimal number in escape"));
|
||||
}
|
||||
self.append_output(
|
||||
char::from_u32(ENCODE_DIRECT_BASE + esc_value % 256)
|
||||
char::from_u32(ENCODE_DIRECT_BASE as u32 + esc_value % 256)
|
||||
.expect("Escape should be encodeable"),
|
||||
);
|
||||
} else if is_octal_digit(p.char_at(0)) {
|
||||
@ -649,7 +649,7 @@ impl<'a> builtin_printf_state_t<'a> {
|
||||
p = &p[1..];
|
||||
}
|
||||
self.append_output(
|
||||
char::from_u32(ENCODE_DIRECT_BASE + esc_value % 256)
|
||||
char::from_u32(ENCODE_DIRECT_BASE as u32 + esc_value % 256)
|
||||
.expect("Escape should be encodeable"),
|
||||
);
|
||||
} else if "\"\\abcefnrtv".contains(p.char_at(0)) {
|
||||
|
@ -107,16 +107,6 @@ impl<T, F: FnOnce(&mut T)> Drop for ScopeGuard<T, F> {
|
||||
unsafe { ManuallyDrop::drop(&mut self.captured) };
|
||||
}
|
||||
}
|
||||
// These are in the Unicode private-use range. We really shouldn't use this
|
||||
// range but have little choice in the matter given how our lexer/parser works.
|
||||
// We can't use non-characters for these two ranges because there are only 66 of
|
||||
// them and we need at least 256 + 64.
|
||||
//
|
||||
// Note: We don't use the highest 8 bit range (0xF800 - 0xF8FF) because we know
|
||||
// of at least one use of a codepoint in that range: the Apple symbol (0xF8FF)
|
||||
// on Mac OS X. See http://www.unicode.org/faq/private_use.html.
|
||||
pub const ENCODE_DIRECT_BASE: u32 = 0xF600;
|
||||
pub const ENCODE_DIRECT_END: u32 = ENCODE_DIRECT_BASE + 256;
|
||||
|
||||
/// A scoped manager to save the current value of some variable, and optionally set it to a new
|
||||
/// value. When dropped, it restores the variable to its old value.
|
||||
|
@ -61,8 +61,8 @@ pub const WILDCARD_RESERVED_END: char = match char::from_u32(WILDCARD_RESERVED_B
|
||||
// Note: We don't use the highest 8 bit range (0xF800 - 0xF8FF) because we know
|
||||
// of at least one use of a codepoint in that range: the Apple symbol (0xF8FF)
|
||||
// on Mac OS X. See http://www.unicode.org/faq/private_use.html.
|
||||
const ENCODE_DIRECT_BASE: char = '\u{F600}';
|
||||
const ENCODE_DIRECT_END: char = match char::from_u32(ENCODE_DIRECT_BASE as u32 + 256) {
|
||||
pub const ENCODE_DIRECT_BASE: char = '\u{F600}';
|
||||
pub const ENCODE_DIRECT_END: char = match char::from_u32(ENCODE_DIRECT_BASE as u32 + 256) {
|
||||
Some(c) => c,
|
||||
None => panic!("private use codepoint in encode direct region should be valid char"),
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user