typeterm editor: add vertical view for ladders

This commit is contained in:
Michael Sippel 2023-08-23 21:53:05 +02:00
parent ef99a986a8
commit 21484979a4
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -33,7 +33,20 @@ pub fn init_ctx(ctx: &mut Context) {
MorphismTypePattern { src_tyid: ctx.get_typeid("List"), dst_tyid: ctx.get_typeid("Type::Ladder").unwrap() }, MorphismTypePattern { src_tyid: ctx.get_typeid("List"), dst_tyid: ctx.get_typeid("Type::Ladder").unwrap() },
Arc::new(|mut node, _dst_type: _| { Arc::new(|mut node, _dst_type: _| {
PTYListController::for_node( &mut node, Some('~'), None ); PTYListController::for_node( &mut node, Some('~'), None );
let vertical_view = true;
if vertical_view {
let editor = node.get_edit::<crate::editors::list::ListEditor>().unwrap();
let mut e = editor.write().unwrap();
let mut seg_view = PTYListStyle::new( ("","~",""), 0 ).get_seg_seq_view( &mut e );
node = node.set_view(
seg_view.to_grid_vertical().flatten()
);
} else {
PTYListStyle::for_node( &mut node, ("","~","") ); PTYListStyle::for_node( &mut node, ("","~","") );
}
Some(node) Some(node)
})); }));
@ -95,7 +108,7 @@ pub fn init_ctx(ctx: &mut Context) {
); );
node.close_char.set(Some('\'')); node.close_char.set(Some('\''));
node.view = Some( node = node.set_view(
grid.get_port() grid.get_port()
.flatten() .flatten()
); );