From b7d5e6480abf6625fbf962176ecdc024f742a49a Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Tue, 20 May 2025 22:53:50 +0800 Subject: [PATCH] gpui: Fix `shape_text` split to support \r\n (#31022) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Release Notes: - N/A --- Today I check the shape_text result on Windows, I get: 屏幕截图 2025-05-20 222908 Here the `shape_text` split logic I think it should use `lines` method, not `split('\n')`, the newline on Windows is `\r\n`. --- 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 3aa78491eb35369bdb7d8cfdb16506a83678506b..b521c6c5a995f1272a3b40c062cd745e912bc73f 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.split('\n'); + let mut split_lines = text.lines(); let mut processed = false; if let Some(first_line) = split_lines.next() {