feat: disable undo in read only textbuffers

This commit is contained in:
Gabriele Musco 2023-10-02 07:06:09 +02:00
commit 8508a06e2a
No known key found for this signature in database
GPG key ID: 1068D795C80E51DE
4 changed files with 4 additions and 1 deletions

View file

@ -204,7 +204,7 @@ impl SimpleComponent for BuildWindow {
title: "".into(), title: "".into(),
content: "".into(), content: "".into(),
can_close: false, can_close: false,
textbuf: gtk::TextBuffer::builder().build(), textbuf: gtk::TextBuffer::builder().enable_undo(false).build(),
textview: None, textview: None,
build_status: BuildStatus::Building, build_status: BuildStatus::Building,
win: None, win: None,

View file

@ -223,6 +223,7 @@ impl SimpleComponent for DebugView {
) -> ComponentParts<Self> { ) -> ComponentParts<Self> {
let textbuf = sourceview5::Buffer::builder() let textbuf = sourceview5::Buffer::builder()
.highlight_syntax(false) .highlight_syntax(false)
.enable_undo(false)
.build(); .build();
if let Some(scheme) = &sourceview5::StyleSchemeManager::new().scheme("Adwaita-dark") { if let Some(scheme) = &sourceview5::StyleSchemeManager::new().scheme("Adwaita-dark") {
textbuf.set_style_scheme(Some(scheme)); textbuf.set_style_scheme(Some(scheme));

View file

@ -296,6 +296,7 @@ impl SimpleComponent for MainView {
} }
res res
} }
set_enable_undo: false,
} }
} }
}, },

View file

@ -70,6 +70,7 @@ impl SimpleComponent for SteamLaunchOptionsBox {
set_buffer: cmdbuf = &gtk::TextBuffer { set_buffer: cmdbuf = &gtk::TextBuffer {
#[track = "model.changed(Self::launch_options())"] #[track = "model.changed(Self::launch_options())"]
set_text: model.launch_options.as_str(), set_text: model.launch_options.as_str(),
set_enable_undo: false,
} }
} }
}, },