Add a new argument to BGI script

This commit is contained in:
2025-11-15 21:52:46 +08:00
parent 37cade659b
commit 5fd1a336c6
4 changed files with 21 additions and 0 deletions

View File

@@ -68,6 +68,7 @@ pub struct BGIScript {
import_duplicate: bool,
append: bool,
custom_yaml: bool,
add_space: bool,
}
impl std::fmt::Debug for BGIScript {
@@ -101,6 +102,7 @@ impl BGIScript {
import_duplicate: config.bgi_import_duplicate,
append: !config.bgi_disable_append,
custom_yaml: config.custom_yaml,
add_space: config.bgi_add_space,
})
} else {
let mut is_v1_instr = false;
@@ -126,6 +128,7 @@ impl BGIScript {
import_duplicate: config.bgi_import_duplicate,
append: !config.bgi_disable_append,
custom_yaml: config.custom_yaml,
add_space: config.bgi_add_space,
})
}
}
@@ -226,6 +229,13 @@ impl Script for BGIScript {
encoding: Encoding,
replacement: Option<&'a ReplacementTable>,
) -> Result<()> {
if self.add_space {
for mes in messages.iter_mut() {
if !mes.message.ends_with(' ') {
mes.message.push(' ');
}
}
}
if !self.import_duplicate {
let mut used = HashMap::new();
let mut extra = HashMap::new();