Update toss to version with separate widthdb
This commit is contained in:
parent
5ed0cd5f3f
commit
61a9cc10f1
8 changed files with 101 additions and 94 deletions
|
|
@ -75,7 +75,8 @@ impl<M: Msg + ChatMsg, S: MsgStore<M>> InnerTreeViewState<M, S> {
|
|||
frame: &mut Frame,
|
||||
indent: usize,
|
||||
) -> Block<BlockId<M::Id>> {
|
||||
let (widget, cursor_row) = widgets::editor::<M>(frame, indent, &context.nick, &self.editor);
|
||||
let (widget, cursor_row) =
|
||||
widgets::editor::<M>(frame.widthdb(), indent, &context.nick, &self.editor);
|
||||
let cursor_row = cursor_row as i32;
|
||||
Block::new(frame, BlockId::Cursor, widget).focus(cursor_row..cursor_row + 1)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ mod seen;
|
|||
mod time;
|
||||
|
||||
use crossterm::style::{ContentStyle, Stylize};
|
||||
use toss::frame::Frame;
|
||||
use toss::styled::Styled;
|
||||
use toss::widthdb::WidthDb;
|
||||
|
||||
use super::super::ChatMsg;
|
||||
use crate::store::Msg;
|
||||
|
|
@ -111,14 +111,14 @@ pub fn msg_placeholder(
|
|||
}
|
||||
|
||||
pub fn editor<M: ChatMsg>(
|
||||
frame: &mut Frame,
|
||||
widthdb: &mut WidthDb,
|
||||
indent: usize,
|
||||
nick: &str,
|
||||
editor: &EditorState,
|
||||
) -> (BoxedWidget, usize) {
|
||||
let (nick, content) = M::edit(nick, &editor.text());
|
||||
let editor = editor.widget().highlight(|_| content);
|
||||
let cursor_row = editor.cursor_row(frame);
|
||||
let cursor_row = editor.cursor_row(widthdb);
|
||||
|
||||
let widget = HJoin::new(vec![
|
||||
Segment::new(seen::widget(true)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue