Add focus and hiding options to editor
This commit is contained in:
parent
e24a5ee1c4
commit
84930c8c34
3 changed files with 38 additions and 20 deletions
|
|
@ -1,35 +1,24 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use crossterm::event::KeyCode;
|
||||
use crossterm::style::{ContentStyle, Stylize};
|
||||
use parking_lot::FairMutex;
|
||||
use toss::terminal::Terminal;
|
||||
|
||||
use crate::euph::Room;
|
||||
use crate::ui::input::{key, InputEvent, KeyBindingsList, KeyEvent};
|
||||
use crate::ui::util;
|
||||
use crate::ui::widgets::cursor::Cursor;
|
||||
use crate::ui::widgets::editor::EditorState;
|
||||
use crate::ui::widgets::padding::Padding;
|
||||
use crate::ui::widgets::popup::Popup;
|
||||
use crate::ui::widgets::text::Text;
|
||||
use crate::ui::widgets::BoxedWidget;
|
||||
|
||||
pub fn new() -> EditorState {
|
||||
EditorState::new()
|
||||
}
|
||||
|
||||
pub fn widget() -> BoxedWidget {
|
||||
Popup::new(
|
||||
Padding::new(Cursor::new(Text::new((
|
||||
"<hidden>",
|
||||
ContentStyle::default().grey().italic(),
|
||||
))))
|
||||
.left(1),
|
||||
)
|
||||
.title("Enter password")
|
||||
.inner_padding(false)
|
||||
.build()
|
||||
pub fn widget(editor: &EditorState) -> BoxedWidget {
|
||||
Popup::new(editor.widget().hidden())
|
||||
.title("Enter password")
|
||||
.build()
|
||||
}
|
||||
|
||||
pub fn list_key_bindings(bindings: &mut KeyBindingsList) {
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ impl EuphRoom {
|
|||
|
||||
match &self.state {
|
||||
State::Normal => {}
|
||||
State::Auth(_) => layers.push(auth::widget()),
|
||||
State::Auth(editor) => layers.push(auth::widget(editor)),
|
||||
State::Nick(editor) => layers.push(nick::widget(editor)),
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue