From e89bd14809aab98fc5edf7f83f8dae2dec923a95 Mon Sep 17 00:00:00 2001 From: Vika Date: Tue, 20 Aug 2024 18:42:00 +0300 Subject: Make the TextView scrollable --- src/lib.rs | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f5cb19e..e97a9fa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -190,20 +190,27 @@ impl AsyncComponent for PostComposerModel { }, #[name = "content_textarea"] - gtk::TextView { - set_buffer: Some(&model.content_buffer), - set_hexpand: true, + gtk::ScrolledWindow { set_vexpand: true, - set_css_classes: &["frame", "view"], - set_monospace: true, - set_left_margin: 8, - set_right_margin: 8, - set_top_margin: 8, - set_bottom_margin: 8, - #[track = "model.changed(Self::submit_busy_guard())"] - set_sensitive: model.submit_busy_guard.is_none(), - }, + gtk::TextView { + set_buffer: Some(&model.content_buffer), + set_hexpand: true, + set_css_classes: &["frame", "view"], + + set_monospace: true, + set_wrap_mode: gtk::WrapMode::Word, + set_vscroll_policy: gtk::ScrollablePolicy::Natural, + + set_left_margin: 8, + set_right_margin: 8, + set_top_margin: 8, + set_bottom_margin: 8, + + #[track = "model.changed(Self::submit_busy_guard())"] + set_sensitive: model.submit_busy_guard.is_none(), + } + } }, add_breakpoint = adw::Breakpoint::new( -- cgit 1.4.1