Make store room-specific

This commit is contained in:
Joscha 2022-06-15 11:29:02 +02:00
parent 15213f8003
commit 23c551a5b7
7 changed files with 85 additions and 173 deletions

View file

@ -29,7 +29,6 @@ impl<M: Msg> TreeView<M> {
pub async fn handle_key_event<S: MsgStore<M>>(
&mut self,
r: &str,
s: &mut S,
c: &mut Option<Cursor<M::Id>>,
f: &mut Frame,
@ -37,13 +36,13 @@ impl<M: Msg> TreeView<M> {
event: KeyEvent,
) {
match event.code {
KeyCode::Char('z') | KeyCode::Char('Z') => self.center_cursor(r, s, c, f, z).await,
KeyCode::Char('k') => self.move_up(r, s, c, f, z).await,
KeyCode::Char('j') => self.move_down(r, s, c, f, z).await,
KeyCode::Char('K') => self.move_up_sibling(r, s, c, f, z).await,
KeyCode::Char('J') => self.move_down_sibling(r, s, c, f, z).await,
KeyCode::Char('g') => self.move_to_first(r, s, c, f, z).await,
KeyCode::Char('G') => self.move_to_last(r, s, c, f, z).await,
KeyCode::Char('z') | KeyCode::Char('Z') => self.center_cursor(s, c, f, z).await,
KeyCode::Char('k') => self.move_up(s, c, f, z).await,
KeyCode::Char('j') => self.move_down(s, c, f, z).await,
KeyCode::Char('K') => self.move_up_sibling(s, c, f, z).await,
KeyCode::Char('J') => self.move_down_sibling(s, c, f, z).await,
KeyCode::Char('g') => self.move_to_first(s, c, f, z).await,
KeyCode::Char('G') => self.move_to_last(s, c, f, z).await,
KeyCode::Esc => *c = None, // TODO Make 'G' do the same thing?
_ => {}
}
@ -51,7 +50,6 @@ impl<M: Msg> TreeView<M> {
pub async fn render<S: MsgStore<M>>(
&mut self,
room: &str,
store: &mut S,
cursor: &Option<Cursor<M::Id>>,
frame: &mut Frame,
@ -59,7 +57,7 @@ impl<M: Msg> TreeView<M> {
size: Size,
) {
let blocks = self
.layout_blocks(room, store, cursor.as_ref(), frame, size)
.layout_blocks(store, cursor.as_ref(), frame, size)
.await;
Self::render_blocks(frame, pos, size, &blocks);
}