export entire TextView widget reference to the Search component

This commit is contained in:
yggverse 2024-12-17 02:13:47 +02:00
parent e0cb5d7a0f
commit 8b65df99f4
8 changed files with 52 additions and 43 deletions

View file

@ -0,0 +1,28 @@
mod tag;
use tag::Tag;
use gtk::{
prelude::{TextBufferExt, TextViewExt},
TextView,
};
pub struct Subject {
pub text_view: TextView,
pub tag: Tag,
}
impl Subject {
// Constructors
/// Create new `Self`
pub fn new(text_view: TextView) -> Self {
// Init components
// * create new tag objects required for new buffer,
// instead of re-use existing refs (maybe the bug)
let tag = Tag::new(text_view.buffer().tag_table());
// Init `Self`
Self { text_view, tag }
}
}