From 65e751ca339b59a2e90408d76472fe6a5dcf3009 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Wed, 21 May 2025 00:01:47 +0800 Subject: [PATCH] Revert "gpui: Fix `shape_text` split to support \r\n" (#31031) Reverts zed-industries/zed#31022 Sorry @mikayla-maki, I found that things are more complicated than I thought. The lines returned by shape_text must maintain the same length as all the original characters, otherwise the subsequent offset needs to always consider the difference of `\r\n` or `\n` to do the offset. Before, we only needed to add +1 after each offset after the line, but now we need to consider +1 or +2, which is much more complicated. --- crates/gpui/src/text_system.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/gpui/src/text_system.rs b/crates/gpui/src/text_system.rs index b521c6c5a995f1272a3b40c062cd745e912bc73f..3aa78491eb35369bdb7d8cfdb16506a83678506b 100644 --- a/crates/gpui/src/text_system.rs +++ b/crates/gpui/src/text_system.rs @@ -474,7 +474,7 @@ impl WindowTextSystem { font_runs.clear(); }; - let mut split_lines = text.lines(); + let mut split_lines = text.split('\n'); let mut processed = false; if let Some(first_line) = split_lines.next() {