minor syntax optimizations

This commit is contained in:
yggverse 2026-03-23 02:34:35 +02:00
parent e92eb318b3
commit 38f9cca422

View file

@ -151,11 +151,7 @@ impl Gemini {
match syntax.highlight(&c.value, alt) { match syntax.highlight(&c.value, alt) {
Ok(highlight) => { Ok(highlight) => {
for (syntax_tag, entity) in highlight { for (syntax_tag, entity) in highlight {
// Register new tag assert!(tag.text_tag_table.add(&syntax_tag));
if !tag.text_tag_table.add(&syntax_tag) {
todo!()
}
// Append tag to buffer
buffer.insert_with_tags( buffer.insert_with_tags(
&mut buffer.end_iter(), &mut buffer.end_iter(),
&entity, &entity,
@ -166,11 +162,7 @@ impl Gemini {
Err(_) => { Err(_) => {
// Try ANSI/SGR format (terminal emulation) @TODO optional // Try ANSI/SGR format (terminal emulation) @TODO optional
for (syntax_tag, entity) in ansi::format(&c.value) { for (syntax_tag, entity) in ansi::format(&c.value) {
// Register new tag assert!(tag.text_tag_table.add(&syntax_tag));
if !tag.text_tag_table.add(&syntax_tag) {
todo!()
}
// Append tag to buffer
buffer.insert_with_tags( buffer.insert_with_tags(
&mut buffer.end_iter(), &mut buffer.end_iter(),
&entity, &entity,
@ -187,7 +179,7 @@ impl Gemini {
// Skip other actions for this line // Skip other actions for this line
continue; continue;
} }
Err(_) => todo!(), Err(_) => panic!(),
} }
} }
} }