pty editor: more resilient handling of results in join functions
This commit is contained in:
parent
fb20fb94e7
commit
f1eedad3fe
1 changed files with 24 additions and 18 deletions
|
@ -192,7 +192,8 @@ impl PTYListEditor {
|
|||
{
|
||||
let prev_editor = e.data.get_mut(idx as usize-1);
|
||||
let prev_editor = prev_editor.editor.clone();
|
||||
let prev_editor = prev_editor.unwrap().downcast::<RwLock<ListEditor>>().unwrap();
|
||||
if let Some(prev_editor) = prev_editor {
|
||||
if let Ok(prev_editor) = prev_editor.downcast::<RwLock<ListEditor>>() {
|
||||
let mut prev_editor = prev_editor.write().unwrap();
|
||||
|
||||
let cur_editor = item.editor.clone().unwrap();
|
||||
|
@ -200,7 +201,6 @@ impl PTYListEditor {
|
|||
let cur_editor = cur_editor.write().unwrap();
|
||||
|
||||
prev_editor.join(&cur_editor);
|
||||
}
|
||||
|
||||
e.cursor.set(
|
||||
ListCursor {
|
||||
|
@ -208,21 +208,27 @@ impl PTYListEditor {
|
|||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
e.data.remove(idx as usize);
|
||||
}
|
||||
|
||||
fn join_nexd(e: &mut ListEditor, next_idx: usize, item: &NestedNode) {
|
||||
{
|
||||
let next_editor = e.data.get_mut(next_idx).editor.clone();
|
||||
let next_editor = next_editor.unwrap().downcast::<RwLock<ListEditor>>().unwrap();
|
||||
let next_editor = next_editor.write().unwrap();
|
||||
|
||||
if let Some(next_editor) = next_editor {
|
||||
if let Ok(next_editor) = next_editor.downcast::<RwLock<ListEditor>>() {
|
||||
let mut next_editor = next_editor.write().unwrap();
|
||||
let cur_editor = item.editor.clone().unwrap();
|
||||
let cur_editor = cur_editor.downcast::<RwLock<ListEditor>>().unwrap();
|
||||
let mut cur_editor = cur_editor.write().unwrap();
|
||||
|
||||
cur_editor.join(&next_editor);
|
||||
}
|
||||
}
|
||||
}
|
||||
e.data.remove(next_idx);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue