From 53f8fe7be752b65a412b7feef26da8e1531f9fd8 Mon Sep 17 00:00:00 2001 From: robtfm <50659922+robtfm@users.noreply.github.com> Date: Mon, 27 Apr 2026 15:45:21 +0100 Subject: [PATCH] feat(ui_input): support multi-line text input from scenes Adds the new optional `multi_line` flag from `PBUiInput` (decentraland/protocol#394) and threads it through to `TextEntry`. When true the text input behaves as a multi-line textarea: plain Enter inserts a newline; Shift+Enter or NumpadEnter submits. Also bumps `bevy_simple_text_input` (robtfm/bevy_simple_text_input branch 0.16) to pick up the matching binding flip and a cursor-clamp fix that prevented panics when the buffer shrank past the cursor's line. Co-Authored-By: Claude Opus 4.7 (1M context) --- Cargo.lock | 2 +- .../src/proto/decentraland/sdk/components/ui_input.proto | 1 + crates/scene_runner/src/update_world/scene_ui/ui_input.rs | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 2a151ff3d..80b29b0dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1732,7 +1732,7 @@ dependencies = [ [[package]] name = "bevy_simple_text_input" version = "0.11.1" -source = "git+https://github.com/robtfm/bevy_simple_text_input?branch=0.16#b4152ef499f8db65023d55a46adc528551a9d725" +source = "git+https://github.com/robtfm/bevy_simple_text_input?branch=0.16#b4602cd531de4047d1c7f7ceb88acf45b20519a1" dependencies = [ "bevy", "copypwasmta", diff --git a/crates/dcl_component/src/proto/decentraland/sdk/components/ui_input.proto b/crates/dcl_component/src/proto/decentraland/sdk/components/ui_input.proto index 33dac4482..5ef2960f7 100644 --- a/crates/dcl_component/src/proto/decentraland/sdk/components/ui_input.proto +++ b/crates/dcl_component/src/proto/decentraland/sdk/components/ui_input.proto @@ -17,4 +17,5 @@ message PBUiInput { optional common.Font font = 11; // default=0 optional int32 font_size = 12; // default=10 optional string value = 13; + optional bool multi_line = 14; // default=false; when true, the input accepts newlines and behaves as a textarea } \ No newline at end of file diff --git a/crates/scene_runner/src/update_world/scene_ui/ui_input.rs b/crates/scene_runner/src/update_world/scene_ui/ui_input.rs index bba7bb997..552f8e800 100644 --- a/crates/scene_runner/src/update_world/scene_ui/ui_input.rs +++ b/crates/scene_runner/src/update_world/scene_ui/ui_input.rs @@ -56,6 +56,7 @@ pub fn set_ui_input( components::common::Font::FMonospace => FontName::Mono, }; let font_size = input.0.font_size.unwrap_or(10).max(1) as f32; + let multiline = input.0.multi_line.unwrap_or(false); let ui_entity = link.ui_entity; let root = scene_ent.root; @@ -118,6 +119,7 @@ pub fn set_ui_input( enabled: !input.0.disabled, content: input.0.value.clone().unwrap_or_default(), accept_line: true, + multiline: if multiline { 2 } else { 1 }, text_style: Some(( TextFont { font: user_font(font_name, ui_core::WeightName::Regular),