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(),
content: "".into(),
can_close: false,
textbuf: gtk::TextBuffer::builder().build(),
textbuf: gtk::TextBuffer::builder().enable_undo(false).build(),
textview: None,
build_status: BuildStatus::Building,
win: None,

View file

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

View file

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

View file

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