mirror of
https://github.com/YGGverse/ggemtext.git
synced 2026-03-31 17:15:33 +00:00
trim list line, replace GString with String, allow empty value
This commit is contained in:
parent
c6f747fefd
commit
4741365154
1 changed files with 4 additions and 8 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use glib::{GString, Regex, RegexCompileFlags, RegexMatchFlags};
|
||||
use glib::{Regex, RegexCompileFlags, RegexMatchFlags};
|
||||
|
||||
pub struct List {
|
||||
pub value: GString,
|
||||
pub value: String,
|
||||
}
|
||||
|
||||
impl List {
|
||||
|
|
@ -15,15 +15,11 @@ impl List {
|
|||
);
|
||||
|
||||
// Detect value
|
||||
let value = regex.get(1)?;
|
||||
|
||||
if value.trim().is_empty() {
|
||||
return None;
|
||||
}
|
||||
let value = regex.get(1)?.trim();
|
||||
|
||||
// Result
|
||||
Some(Self {
|
||||
value: GString::from(value.as_str()),
|
||||
value: String::from(value),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue