digit editor: create char repr if not available

This commit is contained in:
Michael Sippel 2024-03-23 21:32:12 +01:00
parent edf088b853
commit 91e56d876d
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -39,6 +39,20 @@ pub fn init_ctx( ctx: Arc<RwLock<Context>> ) {
_ => 0 _ => 0
}; };
/* get char representation or create it if not available
*/
let char_rt =
if let Some(crt) = src_rt.descend(Context::parse(&ctx, "Char")) {
crt
} else {
let crt = ReprTree::from_singleton_buffer(
Context::parse(&ctx, "Char"),
SingletonBuffer::new('\0')
);
src_rt.insert_branch(crt.clone());
crt
};
/* Create EditTree object /* Create EditTree object
*/ */
let mut edittree = DigitEditor::new( let mut edittree = DigitEditor::new(