mirror of
https://github.com/void-linux/void-packages.git
synced 2025-04-22 17:17:03 +02:00
wezterm: update to 20221119-145034-49b9839f
Signed-off-by: Joseph Benden <joe@benden.us>
This commit is contained in:
parent
2c33025627
commit
993a66ae5c
3 changed files with 7 additions and 259 deletions
|
@ -1,232 +0,0 @@
|
|||
From 7b904f05eb4de9ed44d2068355a571b117eba0e1 Mon Sep 17 00:00:00 2001
|
||||
From: Wez Furlong <wez@wezfurlong.org>
|
||||
Date: Sat, 15 Oct 2022 16:45:02 -0700
|
||||
Subject: [PATCH] termwiz: fixup for 32-bit systems
|
||||
|
||||
I noticed from https://github.com/void-linux/void-packages/pull/36903
|
||||
that 32-bit systems were failing to pass the test suite.
|
||||
|
||||
Running `cargo test --target i686-unknown-linux-gnu -- --nocapture
|
||||
teeny_string` showed that we were faulting in the teenystring code
|
||||
and digging a bit deeper showed that it was because our assumptions
|
||||
about the high bits were wrong for 32-bit systems.
|
||||
|
||||
Fix this by making TeenyString based around a u64 rather than usize
|
||||
so that we guarantee its size on all current systems.
|
||||
---
|
||||
Cargo.lock | 1 -
|
||||
termwiz/Cargo.toml | 1 -
|
||||
termwiz/src/cell.rs | 87 ++++++++++++++-------------------------------
|
||||
3 files changed, 26 insertions(+), 63 deletions(-)
|
||||
|
||||
diff --git a/Cargo.lock b/Cargo.lock
|
||||
index 4f976535be..243e3a2b24 100644
|
||||
--- a/Cargo.lock
|
||||
+++ b/Cargo.lock
|
||||
@@ -4739,7 +4739,6 @@ dependencies = [
|
||||
"base64",
|
||||
"bitflags",
|
||||
"cassowary",
|
||||
- "cfg-if 1.0.0",
|
||||
"criterion",
|
||||
"env_logger",
|
||||
"filedescriptor",
|
||||
diff --git a/termwiz/Cargo.toml b/termwiz/Cargo.toml
|
||||
index d8d7ab543c..e843bac261 100644
|
||||
--- a/termwiz/Cargo.toml
|
||||
+++ b/termwiz/Cargo.toml
|
||||
@@ -15,7 +15,6 @@ readme = "README.md"
|
||||
base64 = "0.13"
|
||||
bitflags = "1.3"
|
||||
cassowary = {version="0.3", optional=true}
|
||||
-cfg-if = "1.0"
|
||||
anyhow = "1.0"
|
||||
filedescriptor = { version="0.8", path = "../filedescriptor" }
|
||||
finl_unicode = "1.1"
|
||||
diff --git a/termwiz/src/cell.rs b/termwiz/src/cell.rs
|
||||
index ddf38a93bb..70d6099dd0 100644
|
||||
--- a/termwiz/src/cell.rs
|
||||
+++ b/termwiz/src/cell.rs
|
||||
@@ -590,7 +590,7 @@ where
|
||||
s.serialize(serializer)
|
||||
}
|
||||
|
||||
-/// TeenyString encodes string storage in a single machine word.
|
||||
+/// TeenyString encodes string storage in a single u64.
|
||||
/// The scheme is simple but effective: strings that encode into a
|
||||
/// byte slice that is 1 less byte than the machine word size can
|
||||
/// be encoded directly into the usize bits stored in the struct.
|
||||
@@ -603,60 +603,40 @@ where
|
||||
/// calling grapheme_column_width; if it is set, then the TeenyString
|
||||
/// has length 2, otherwise, it has length 1 (we don't allow zero-length
|
||||
/// strings).
|
||||
-struct TeenyString(usize);
|
||||
+struct TeenyString(u64);
|
||||
struct TeenyStringHeap {
|
||||
bytes: Vec<u8>,
|
||||
width: usize,
|
||||
}
|
||||
|
||||
impl TeenyString {
|
||||
- const fn marker_mask() -> usize {
|
||||
+ const fn marker_mask() -> u64 {
|
||||
if cfg!(target_endian = "little") {
|
||||
- cfg_if::cfg_if! {
|
||||
- if #[cfg(target_pointer_width = "64")] {
|
||||
- 0x80000000_00000000
|
||||
- } else if #[cfg(target_pointer_width = "32")] {
|
||||
- 0x80000000
|
||||
- } else if #[cfg(target_pointer_width = "16")] {
|
||||
- 0x8000
|
||||
- } else {
|
||||
- panic!("unsupported target");
|
||||
- }
|
||||
- }
|
||||
+ 0x80000000_00000000
|
||||
} else {
|
||||
0x1
|
||||
}
|
||||
}
|
||||
|
||||
- const fn double_wide_mask() -> usize {
|
||||
+ const fn double_wide_mask() -> u64 {
|
||||
if cfg!(target_endian = "little") {
|
||||
- cfg_if::cfg_if! {
|
||||
- if #[cfg(target_pointer_width = "64")] {
|
||||
- 0xc0000000_00000000
|
||||
- } else if #[cfg(target_pointer_width = "32")] {
|
||||
- 0xc0000000
|
||||
- } else if #[cfg(target_pointer_width = "16")] {
|
||||
- 0xc000
|
||||
- } else {
|
||||
- panic!("unsupported target");
|
||||
- }
|
||||
- }
|
||||
+ 0xc0000000_00000000
|
||||
} else {
|
||||
0x3
|
||||
}
|
||||
}
|
||||
|
||||
- const fn is_marker_bit_set(word: usize) -> bool {
|
||||
+ const fn is_marker_bit_set(word: u64) -> bool {
|
||||
let mask = Self::marker_mask();
|
||||
word & mask == mask
|
||||
}
|
||||
|
||||
- const fn is_double_width(word: usize) -> bool {
|
||||
+ const fn is_double_width(word: u64) -> bool {
|
||||
let mask = Self::double_wide_mask();
|
||||
word & mask == mask
|
||||
}
|
||||
|
||||
- const fn set_marker_bit(word: usize, width: usize) -> usize {
|
||||
+ const fn set_marker_bit(word: u64, width: usize) -> u64 {
|
||||
if width > 1 {
|
||||
word | Self::double_wide_mask()
|
||||
} else {
|
||||
@@ -689,18 +669,18 @@ impl TeenyString {
|
||||
let len = bytes.len();
|
||||
let width = width.unwrap_or_else(|| grapheme_column_width(s, unicode_version));
|
||||
|
||||
- if len < std::mem::size_of::<usize>() {
|
||||
+ if len < std::mem::size_of::<u64>() {
|
||||
debug_assert!(width < 3);
|
||||
|
||||
- let mut word = 0usize;
|
||||
+ let mut word = 0u64;
|
||||
unsafe {
|
||||
std::ptr::copy_nonoverlapping(
|
||||
bytes.as_ptr(),
|
||||
- &mut word as *mut usize as *mut u8,
|
||||
+ &mut word as *mut u64 as *mut u8,
|
||||
len,
|
||||
);
|
||||
}
|
||||
- let word = Self::set_marker_bit(word, width);
|
||||
+ let word = Self::set_marker_bit(word as u64, width);
|
||||
Self(word)
|
||||
} else {
|
||||
let vec = Box::new(TeenyStringHeap {
|
||||
@@ -708,35 +688,15 @@ impl TeenyString {
|
||||
width,
|
||||
});
|
||||
let ptr = Box::into_raw(vec);
|
||||
- Self(ptr as usize)
|
||||
+ Self(ptr as u64)
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn space() -> Self {
|
||||
Self(if cfg!(target_endian = "little") {
|
||||
- cfg_if::cfg_if! {
|
||||
- if #[cfg(target_pointer_width = "64")] {
|
||||
- 0x80000000_00000020
|
||||
- } else if #[cfg(target_pointer_width = "32")] {
|
||||
- 0x80000020
|
||||
- } else if #[cfg(target_pointer_width = "16")] {
|
||||
- 0x8020
|
||||
- } else {
|
||||
- panic!("unsupported target");
|
||||
- }
|
||||
- }
|
||||
+ 0x80000000_00000020
|
||||
} else {
|
||||
- cfg_if::cfg_if! {
|
||||
- if #[cfg(target_pointer_width = "64")] {
|
||||
- 0x20000000_00000001
|
||||
- } else if #[cfg(target_pointer_width = "32")] {
|
||||
- 0x20000001
|
||||
- } else if #[cfg(target_pointer_width = "16")] {
|
||||
- 0x2001
|
||||
- } else {
|
||||
- panic!("unsupported target");
|
||||
- }
|
||||
- }
|
||||
+ 0x20000000_00000001
|
||||
})
|
||||
}
|
||||
|
||||
@@ -753,7 +713,7 @@ impl TeenyString {
|
||||
1
|
||||
}
|
||||
} else {
|
||||
- let heap = self.0 as *const usize as *const TeenyStringHeap;
|
||||
+ let heap = self.0 as *const u64 as *const TeenyStringHeap;
|
||||
unsafe { (*heap).width }
|
||||
}
|
||||
}
|
||||
@@ -766,17 +726,17 @@ impl TeenyString {
|
||||
|
||||
pub fn as_bytes(&self) -> &[u8] {
|
||||
if Self::is_marker_bit_set(self.0) {
|
||||
- let bytes = &self.0 as *const usize as *const u8;
|
||||
+ let bytes = &self.0 as *const u64 as *const u8;
|
||||
let bytes =
|
||||
- unsafe { std::slice::from_raw_parts(bytes, std::mem::size_of::<usize>() - 1) };
|
||||
+ unsafe { std::slice::from_raw_parts(bytes, std::mem::size_of::<u64>() - 1) };
|
||||
let len = bytes
|
||||
.iter()
|
||||
.position(|&b| b == 0)
|
||||
- .unwrap_or(std::mem::size_of::<usize>() - 1);
|
||||
+ .unwrap_or(std::mem::size_of::<u64>() - 1);
|
||||
|
||||
&bytes[0..len]
|
||||
} else {
|
||||
- let heap = self.0 as *const usize as *const TeenyStringHeap;
|
||||
+ let heap = self.0 as *const u64 as *const TeenyStringHeap;
|
||||
unsafe { (*heap).bytes.as_slice() }
|
||||
}
|
||||
}
|
||||
@@ -1072,6 +1032,11 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn teeny_string() {
|
||||
+ assert!(
|
||||
+ std::mem::size_of::<usize>() <= std::mem::size_of::<u64>(),
|
||||
+ "if a pointer doesn't fit in u64 then we need to change TeenyString"
|
||||
+ );
|
||||
+
|
||||
let s = TeenyString::from_char('a');
|
||||
assert_eq!(s.as_bytes(), &[b'a']);
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
--- a/wezterm-font/src/parser.rs 2022-09-05 10:28:02.000000000 -0700
|
||||
+++ b/wezterm-font/src/parser.rs 2022-10-24 09:06:02.529054286 -0700
|
||||
@@ -715,19 +715,6 @@
|
||||
font!("../../assets/fonts/JetBrainsMono-Regular.ttf"),
|
||||
font!("../../assets/fonts/JetBrainsMono-ThinItalic.ttf"),
|
||||
font!("../../assets/fonts/JetBrainsMono-Thin.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-Black.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-BlackItalic.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-Bold.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-BoldItalic.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-Italic.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-Light.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-LightItalic.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-Medium.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-MediumItalic.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-Regular.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-Thin.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-ThinItalic.ttf"),
|
||||
- font!("../../assets/fonts/NotoColorEmoji.ttf"),
|
||||
font!("../../assets/fonts/Symbols-Nerd-Font-Mono.ttf"),
|
||||
font!("../../assets/fonts/LastResortHE-Regular.ttf"),
|
||||
] {
|
|
@ -1,8 +1,8 @@
|
|||
# Template file for 'wezterm'
|
||||
pkgname=wezterm
|
||||
version=20220905
|
||||
version=20221119
|
||||
revision=1
|
||||
_srcver=${version}-102802-7d4b8249
|
||||
_srcver=${version}-145034-49b9839f
|
||||
archs="x86_64* i686* aarch64* arm*" # ring
|
||||
build_style=cargo
|
||||
configure_args="--no-default-features --features wezterm-gui/distro-defaults,wezterm-gui/wayland"
|
||||
|
@ -17,15 +17,17 @@ license="MIT"
|
|||
homepage="https://wezfurlong.org/wezterm/"
|
||||
changelog="https://wezfurlong.org/wezterm/changelog.html"
|
||||
distfiles="https://github.com/wez/wezterm/releases/download/${_srcver}/wezterm-${_srcver}-src.tar.gz"
|
||||
checksum="5898af2bb2dbedcae2648764d5b7abd3d98b0aa3d05d171b09e0e3f76b7dd545"
|
||||
checksum=6ad923d48c76e5175128f40cd70d3a0c9fd2dc3e3f573af44b9c2ae7608ab7c4
|
||||
|
||||
do_check() {
|
||||
# NOTE: cannot use build_style cargo do_check because of --release flag.
|
||||
# NOTE: e2e::sftp is skipped due to missing ssh
|
||||
# NOTE: shapecache::test::ligatures_jetbrains is skipped due to removal of fonts
|
||||
# NOTE: escape::action_size has bad size due to discriminate
|
||||
# NOTE: surface::line::storage::test::memory_usage has bad size due to discriminate
|
||||
cargo test --target ${RUST_TARGET} --workspace --locked -- \
|
||||
--skip e2e::sftp \
|
||||
--skip shapecache::test::ligatures_jetbrains
|
||||
--skip escape::action_size \
|
||||
--skip surface::line::storage::test::memory_usage
|
||||
}
|
||||
|
||||
do_install() {
|
||||
|
|
Loading…
Add table
Reference in a new issue