Clean up
This commit is contained in:
parent
a97c838474
commit
4cf0d861db
1 changed files with 37 additions and 37 deletions
|
|
@ -4,7 +4,7 @@ use toss::frame::{Frame, Size};
|
||||||
|
|
||||||
use crate::store::{Msg, MsgStore, Path, Tree};
|
use crate::store::{Msg, MsgStore, Path, Tree};
|
||||||
|
|
||||||
use super::blocks::{Block, BlockBody, Blocks, MarkerBlock, MsgBlock};
|
use super::blocks::{Block, BlockBody, Blocks, MsgBlock};
|
||||||
use super::{util, Cursor, InnerTreeViewState};
|
use super::{util, Cursor, InnerTreeViewState};
|
||||||
|
|
||||||
impl<M: Msg, S: MsgStore<M>> InnerTreeViewState<M, S> {
|
impl<M: Msg, S: MsgStore<M>> InnerTreeViewState<M, S> {
|
||||||
|
|
@ -144,7 +144,12 @@ impl<M: Msg, S: MsgStore<M>> InnerTreeViewState<M, S> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(block) = blocks.find(|b| cursor.matches_block(b)) {
|
let block = blocks
|
||||||
|
.find(|b| cursor.matches_block(b))
|
||||||
|
// This should never happen since we always start rendering the
|
||||||
|
// blocks from the cursor.
|
||||||
|
.expect("no cursor found");
|
||||||
|
|
||||||
let min_line = 0;
|
let min_line = 0;
|
||||||
let max_line = size.height as i32 - block.height();
|
let max_line = size.height as i32 - block.height();
|
||||||
if block.line < min_line {
|
if block.line < min_line {
|
||||||
|
|
@ -152,11 +157,6 @@ impl<M: Msg, S: MsgStore<M>> InnerTreeViewState<M, S> {
|
||||||
} else if block.line > max_line {
|
} else if block.line > max_line {
|
||||||
blocks.offset(max_line - block.line);
|
blocks.offset(max_line - block.line);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// This should never happen since we always start rendering the
|
|
||||||
// blocks from the cursor.
|
|
||||||
panic!("no cursor found");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Try to obtain a [`Cursor::Msg`] pointing to the block.
|
/// Try to obtain a [`Cursor::Msg`] pointing to the block.
|
||||||
|
|
@ -178,7 +178,12 @@ impl<M: Msg, S: MsgStore<M>> InnerTreeViewState<M, S> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(block) = blocks.find(|b| cursor.matches_block(b)) {
|
let block = blocks
|
||||||
|
.find(|b| cursor.matches_block(b))
|
||||||
|
// This should never happen since we always start rendering the
|
||||||
|
// blocks from the cursor.
|
||||||
|
.expect("no cursor found");
|
||||||
|
|
||||||
let min_line = 1 - block.height();
|
let min_line = 1 - block.height();
|
||||||
let max_line = size.height as i32 - 1;
|
let max_line = size.height as i32 - 1;
|
||||||
|
|
||||||
|
|
@ -202,11 +207,6 @@ impl<M: Msg, S: MsgStore<M>> InnerTreeViewState<M, S> {
|
||||||
if let Some(new_cursor) = new_cursor {
|
if let Some(new_cursor) = new_cursor {
|
||||||
*cursor = new_cursor;
|
*cursor = new_cursor;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// This should never happen since we always start rendering the
|
|
||||||
// blocks from the cursor.
|
|
||||||
panic!("no cursor found");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn expand_blocks_up(&self, frame: &mut Frame, blocks: &mut Blocks<M::Id>) {
|
async fn expand_blocks_up(&self, frame: &mut Frame, blocks: &mut Blocks<M::Id>) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue