From 5081eafa9d847a6ee42779fc4abb57237bd0855e Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 21 Apr 2022 19:20:46 +0200 Subject: [PATCH] Always wrap lines that are wider than 512 em advances We went with a more conservative upper bound so that the number of characters (hopefully) never exceeds `MAX_LINE_LEN` (1024) when laying out text. Co-Authored-By: Max Brunsfeld --- crates/editor/src/element.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index cd53e62964..eb69463353 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -851,7 +851,7 @@ impl Element for EditorElement { let overscroll = vec2f(em_width, 0.); let snapshot = self.update_view(cx.app, |view, cx| { let wrap_width = match view.soft_wrap_mode(cx) { - SoftWrap::None => None, + SoftWrap::None => Some((MAX_LINE_LEN / 2) as f32 * em_advance), SoftWrap::EditorWidth => { Some(text_width - gutter_margin - overscroll.x() - em_width) }