mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
fmt
This commit is contained in:
@@ -194,7 +194,7 @@ impl Activity for AuthActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// ### will_umount
|
/// ### will_umount
|
||||||
///
|
///
|
||||||
/// `will_umount` is the method which must be able to report to the activity manager, whether
|
/// `will_umount` is the method which must be able to report to the activity manager, whether
|
||||||
/// the activity should be terminated or not.
|
/// the activity should be terminated or not.
|
||||||
/// If not, the call will return `None`, otherwise return`Some(ExitReason)`
|
/// If not, the call will return `None`, otherwise return`Some(ExitReason)`
|
||||||
|
|||||||
@@ -26,8 +26,8 @@
|
|||||||
// Locals
|
// Locals
|
||||||
use super::{AuthActivity, Context, FileTransferProtocol};
|
use super::{AuthActivity, Context, FileTransferProtocol};
|
||||||
use crate::ui::layout::components::{
|
use crate::ui::layout::components::{
|
||||||
bookmark_list::BookmarkList, msgbox::MsgBox, input::Input, radio_group::RadioGroup, table::Table,
|
bookmark_list::BookmarkList, input::Input, msgbox::MsgBox, radio_group::RadioGroup,
|
||||||
text::Text, title::Title,
|
table::Table, text::Text, title::Title,
|
||||||
};
|
};
|
||||||
use crate::ui::layout::props::{
|
use crate::ui::layout::props::{
|
||||||
InputType, PropValue, PropsBuilder, TableBuilder, TextParts, TextSpan, TextSpanBuilder,
|
InputType, PropValue, PropsBuilder, TableBuilder, TextParts, TextSpan, TextSpanBuilder,
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ use super::{Context, SetupActivity, ViewLayout};
|
|||||||
use crate::filetransfer::FileTransferProtocol;
|
use crate::filetransfer::FileTransferProtocol;
|
||||||
use crate::fs::explorer::GroupDirs;
|
use crate::fs::explorer::GroupDirs;
|
||||||
use crate::ui::layout::components::{
|
use crate::ui::layout::components::{
|
||||||
bookmark_list::BookmarkList, msgbox::MsgBox, input::Input, radio_group::RadioGroup, table::Table,
|
bookmark_list::BookmarkList, input::Input, msgbox::MsgBox, radio_group::RadioGroup,
|
||||||
text::Text,
|
table::Table, text::Text,
|
||||||
};
|
};
|
||||||
use crate::ui::layout::props::{
|
use crate::ui::layout::props::{
|
||||||
PropValue, PropsBuilder, TableBuilder, TextParts, TextSpan, TextSpanBuilder,
|
PropValue, PropsBuilder, TableBuilder, TextParts, TextSpan, TextSpanBuilder,
|
||||||
|
|||||||
@@ -52,16 +52,16 @@ impl InputHandler {
|
|||||||
match self.read_event() {
|
match self.read_event() {
|
||||||
Ok(ev_opt) => match ev_opt {
|
Ok(ev_opt) => match ev_opt {
|
||||||
Some(ev) => inbox.push(ev),
|
Some(ev) => inbox.push(ev),
|
||||||
None => break
|
None => break,
|
||||||
},
|
},
|
||||||
Err(_) => return Err(())
|
Err(_) => return Err(()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(inbox)
|
Ok(inbox)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ### read_event
|
/// ### read_event
|
||||||
///
|
///
|
||||||
/// Read event from input listener
|
/// Read event from input listener
|
||||||
pub(crate) fn read_event(&self) -> Result<Option<Event>, ()> {
|
pub(crate) fn read_event(&self) -> Result<Option<Event>, ()> {
|
||||||
if let Ok(available) = poll(Duration::from_millis(10)) {
|
if let Ok(available) = poll(Duration::from_millis(10)) {
|
||||||
@@ -74,7 +74,7 @@ impl InputHandler {
|
|||||||
Err(())
|
Err(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
false => Ok(None)
|
false => Ok(None),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Err(())
|
Err(())
|
||||||
|
|||||||
@@ -206,8 +206,7 @@ impl Component for Input {
|
|||||||
render.render_widget(p, area);
|
render.render_widget(p, area);
|
||||||
// Set cursor, if focus
|
// Set cursor, if focus
|
||||||
if self.states.focus {
|
if self.states.focus {
|
||||||
let x: u16 =
|
let x: u16 = area.x + (self.states.cursor as u16) + 1;
|
||||||
area.x + (self.states.cursor as u16) + 1;
|
|
||||||
render.set_cursor(x, area.y + 1);
|
render.set_cursor(x, area.y + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,11 +26,7 @@
|
|||||||
// locals
|
// locals
|
||||||
use super::{Canvas, Component, InputEvent, Msg, Payload, Props, PropsBuilder};
|
use super::{Canvas, Component, InputEvent, Msg, Payload, Props, PropsBuilder};
|
||||||
// ext
|
// ext
|
||||||
use tui::{
|
use tui::{layout::Rect, style::Style, widgets::Paragraph};
|
||||||
layout::Rect,
|
|
||||||
style::Style,
|
|
||||||
widgets::Paragraph,
|
|
||||||
};
|
|
||||||
|
|
||||||
// -- state
|
// -- state
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,8 @@
|
|||||||
// Modules
|
// Modules
|
||||||
pub mod components;
|
pub mod components;
|
||||||
pub mod props;
|
pub mod props;
|
||||||
pub mod view;
|
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
pub mod view;
|
||||||
|
|
||||||
// locals
|
// locals
|
||||||
use props::{PropValue, Props, PropsBuilder};
|
use props::{PropValue, Props, PropsBuilder};
|
||||||
|
|||||||
@@ -185,7 +185,9 @@ impl View {
|
|||||||
if let Some(active_component) = self.focus.take() {
|
if let Some(active_component) = self.focus.take() {
|
||||||
if active_component != component {
|
if active_component != component {
|
||||||
// Blur active component if are different
|
// 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();
|
active_component.blur();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user