From 1ce46c680ba191b6d3de80cd9ac2ce4b63e4d089 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sun, 15 Dec 2024 12:09:06 +0200 Subject: [PATCH] add found tag --- .../page/content/text/gemini/reader/tag.rs | 6 ++++++ .../content/text/gemini/reader/tag/found.rs | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 src/app/browser/window/tab/item/page/content/text/gemini/reader/tag/found.rs diff --git a/src/app/browser/window/tab/item/page/content/text/gemini/reader/tag.rs b/src/app/browser/window/tab/item/page/content/text/gemini/reader/tag.rs index 72b99c29..72b25287 100644 --- a/src/app/browser/window/tab/item/page/content/text/gemini/reader/tag.rs +++ b/src/app/browser/window/tab/item/page/content/text/gemini/reader/tag.rs @@ -1,3 +1,4 @@ +mod found; mod h1; mod h2; mod h3; @@ -5,6 +6,7 @@ mod list; mod quote; mod title; +use found::Found; use h1::H1; use h2::H2; use h3::H3; @@ -23,6 +25,7 @@ pub struct Tag { pub list: List, pub quote: Quote, pub title: Title, + pub found: Found, } impl Tag { @@ -35,6 +38,7 @@ impl Tag { let list = List::new(); let quote = Quote::new(); let title = Title::new(); + let found = Found::new(); // Init tag table let text_tag_table = TextTagTable::new(); @@ -45,6 +49,7 @@ impl Tag { text_tag_table.add(&title.text_tag); text_tag_table.add(&list.text_tag); text_tag_table.add("e.text_tag); + text_tag_table.add(&found.text_tag); Self { text_tag_table, @@ -55,6 +60,7 @@ impl Tag { list, quote, title, + found, } } } diff --git a/src/app/browser/window/tab/item/page/content/text/gemini/reader/tag/found.rs b/src/app/browser/window/tab/item/page/content/text/gemini/reader/tag/found.rs new file mode 100644 index 00000000..fb578464 --- /dev/null +++ b/src/app/browser/window/tab/item/page/content/text/gemini/reader/tag/found.rs @@ -0,0 +1,19 @@ +use gtk::{gdk::RGBA, TextTag, WrapMode}; + +pub struct Found { + pub text_tag: TextTag, +} + +impl Found { + // Constructors + + /// Create new `Self` + pub fn new() -> Self { + Self { + text_tag: TextTag::builder() + .background_rgba(&RGBA::new(0.502, 0.502, 0.502, 0.5)) // @TODO + .wrap_mode(WrapMode::Word) + .build(), + } + } +}