input: Update GPUI and fix Input changes. (#437)

Ref https://github.com/zed-industries/zed/pull/20968
This commit is contained in:
Jason Lee 2024-11-26 21:41:34 +08:00 committed by GitHub
parent 931d762955
commit 0119c80120
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 16 deletions

26
Cargo.lock generated
View file

@ -474,7 +474,7 @@ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"cexpr", "cexpr",
"clang-sys", "clang-sys",
"itertools 0.13.0", "itertools 0.11.0",
"log", "log",
"prettyplease", "prettyplease",
"proc-macro2", "proc-macro2",
@ -950,7 +950,7 @@ dependencies = [
[[package]] [[package]]
name = "collections" name = "collections"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#54853c7ea3142578a9666c6723c09e92670aec71"
dependencies = [ dependencies = [
"rustc-hash", "rustc-hash",
] ]
@ -1313,7 +1313,7 @@ dependencies = [
[[package]] [[package]]
name = "derive_refineable" name = "derive_refineable"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#54853c7ea3142578a9666c6723c09e92670aec71"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2266,7 +2266,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui" name = "gpui"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#54853c7ea3142578a9666c6723c09e92670aec71"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"as-raw-xcb-connection", "as-raw-xcb-connection",
@ -2365,7 +2365,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_macros" name = "gpui_macros"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#54853c7ea3142578a9666c6723c09e92670aec71"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2555,7 +2555,7 @@ dependencies = [
[[package]] [[package]]
name = "http_client" name = "http_client"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#54853c7ea3142578a9666c6723c09e92670aec71"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@ -3071,12 +3071,11 @@ dependencies = [
[[package]] [[package]]
name = "media" name = "media"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#54853c7ea3142578a9666c6723c09e92670aec71"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bindgen", "bindgen",
"core-foundation 0.9.4", "core-foundation 0.9.4",
"ctor",
"foreign-types", "foreign-types",
"metal", "metal",
"objc", "objc",
@ -3380,7 +3379,7 @@ version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56"
dependencies = [ dependencies = [
"proc-macro-crate 3.2.0", "proc-macro-crate 1.3.1",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.86", "syn 2.0.86",
@ -4351,7 +4350,7 @@ dependencies = [
[[package]] [[package]]
name = "refineable" name = "refineable"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#54853c7ea3142578a9666c6723c09e92670aec71"
dependencies = [ dependencies = [
"derive_refineable", "derive_refineable",
] ]
@ -4672,7 +4671,7 @@ checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a"
[[package]] [[package]]
name = "semantic_version" name = "semantic_version"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#54853c7ea3142578a9666c6723c09e92670aec71"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"serde", "serde",
@ -5090,7 +5089,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]] [[package]]
name = "sum_tree" name = "sum_tree"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#54853c7ea3142578a9666c6723c09e92670aec71"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"log", "log",
@ -5749,7 +5748,7 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
[[package]] [[package]]
name = "util" name = "util"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#54853c7ea3142578a9666c6723c09e92670aec71"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-fs 1.6.0", "async-fs 1.6.0",
@ -5763,6 +5762,7 @@ dependencies = [
"rust-embed", "rust-embed",
"serde", "serde",
"serde_json", "serde_json",
"smol",
"take-until", "take-until",
"tendril", "tendril",
"unicase", "unicase",

View file

@ -463,7 +463,7 @@ impl TextInput {
} }
let old_text = self let old_text = self
.text_for_range(self.range_to_utf16(&range), cx) .text_for_range(self.range_to_utf16(&range), &mut None, cx)
.unwrap_or("".to_string()); .unwrap_or("".to_string());
let new_range = range.start..range.start + new_text.len(); let new_range = range.start..range.start + new_text.len();
@ -552,9 +552,11 @@ impl TextInput {
let mut start = self.offset_to_utf16(offset); let mut start = self.offset_to_utf16(offset);
let mut end = start; let mut end = start;
let prev_text = self.text_for_range(0..start, cx).unwrap_or_default(); let prev_text = self
.text_for_range(0..start, &mut None, cx)
.unwrap_or_default();
let next_text = self let next_text = self
.text_for_range(end..self.text.len(), cx) .text_for_range(end..self.text.len(), &mut None, cx)
.unwrap_or_default(); .unwrap_or_default();
let prev_chars = prev_text.chars().rev().peekable(); let prev_chars = prev_text.chars().rev().peekable();
@ -739,9 +741,11 @@ impl ViewInputHandler for TextInput {
fn text_for_range( fn text_for_range(
&mut self, &mut self,
range_utf16: Range<usize>, range_utf16: Range<usize>,
adjusted_range: &mut Option<Range<usize>>,
_cx: &mut ViewContext<Self>, _cx: &mut ViewContext<Self>,
) -> Option<String> { ) -> Option<String> {
let range = self.range_from_utf16(&range_utf16); let range = self.range_from_utf16(&range_utf16);
adjusted_range.replace(self.range_to_utf16(&range));
Some(self.text[range].to_string()) Some(self.text[range].to_string())
} }