This commit is contained in:
veeso
2021-03-26 20:38:47 +01:00
parent 08b855e779
commit 5a5d2fb162
8 changed files with 15 additions and 18 deletions

View File

@@ -206,8 +206,7 @@ impl Component for Input {
render.render_widget(p, area);
// Set cursor, if focus
if self.states.focus {
let x: u16 =
area.x + (self.states.cursor as u16) + 1;
let x: u16 = area.x + (self.states.cursor as u16) + 1;
render.set_cursor(x, area.y + 1);
}
}

View File

@@ -26,11 +26,7 @@
// locals
use super::{Canvas, Component, InputEvent, Msg, Payload, Props, PropsBuilder};
// ext
use tui::{
layout::Rect,
style::Style,
widgets::Paragraph,
};
use tui::{layout::Rect, style::Style, widgets::Paragraph};
// -- state

View File

@@ -26,8 +26,8 @@
// Modules
pub mod components;
pub mod props;
pub mod view;
pub mod utils;
pub mod view;
// locals
use props::{PropValue, Props, PropsBuilder};

View File

@@ -185,7 +185,9 @@ impl View {
if let Some(active_component) = self.focus.take() {
if active_component != component {
// Blur active component if are different
if let Some(active_component) = self.components.get_mut(active_component.as_str()) {
if let Some(active_component) =
self.components.get_mut(active_component.as_str())
{
active_component.blur();
}
}