mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
Changed Unumber and Number names
This commit is contained in:
@@ -254,7 +254,7 @@ impl Component for FileList {
|
|||||||
///
|
///
|
||||||
/// Return component value. File list return index
|
/// Return component value. File list return index
|
||||||
fn get_value(&self) -> Payload {
|
fn get_value(&self) -> Payload {
|
||||||
Payload::Unumber(self.states.get_list_index())
|
Payload::Unsigned(self.states.get_list_index())
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- events
|
// -- events
|
||||||
@@ -366,7 +366,7 @@ mod tests {
|
|||||||
// Enter
|
// Enter
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
component.on(InputEvent::Key(KeyEvent::from(KeyCode::Enter))),
|
component.on(InputEvent::Key(KeyEvent::from(KeyCode::Enter))),
|
||||||
Msg::OnSubmit(Payload::Unumber(0))
|
Msg::OnSubmit(Payload::Unsigned(0))
|
||||||
);
|
);
|
||||||
// On key
|
// On key
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ impl OwnStates {
|
|||||||
/// Append, if possible according to input type, the character to the input vec
|
/// Append, if possible according to input type, the character to the input vec
|
||||||
pub fn append(&mut self, ch: char, itype: InputType) {
|
pub fn append(&mut self, ch: char, itype: InputType) {
|
||||||
match itype {
|
match itype {
|
||||||
InputType::Number => {
|
InputType::Signed => {
|
||||||
if ch.is_digit(10) {
|
if ch.is_digit(10) {
|
||||||
// Must be digit
|
// Must be digit
|
||||||
self.input.push(ch);
|
self.input.push(ch);
|
||||||
@@ -269,8 +269,8 @@ impl Component for Input {
|
|||||||
/// Returns the value as string or as a number based on the input value
|
/// Returns the value as string or as a number based on the input value
|
||||||
fn get_value(&self) -> Payload {
|
fn get_value(&self) -> Payload {
|
||||||
match self.props.input_type {
|
match self.props.input_type {
|
||||||
InputType::Number => {
|
InputType::Signed => {
|
||||||
Payload::Unumber(self.states.get_value().parse::<usize>().ok().unwrap_or(0))
|
Payload::Unsigned(self.states.get_value().parse::<usize>().ok().unwrap_or(0))
|
||||||
}
|
}
|
||||||
_ => Payload::Text(self.states.get_value()),
|
_ => Payload::Text(self.states.get_value()),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ pub enum Msg {
|
|||||||
#[derive(std::fmt::Debug, PartialEq)]
|
#[derive(std::fmt::Debug, PartialEq)]
|
||||||
pub enum Payload {
|
pub enum Payload {
|
||||||
Text(String),
|
Text(String),
|
||||||
Number(isize),
|
Signed(isize),
|
||||||
Unumber(usize),
|
Unsigned(usize),
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ pub enum PropValue {
|
|||||||
#[derive(Clone, Copy, PartialEq, std::fmt::Debug)]
|
#[derive(Clone, Copy, PartialEq, std::fmt::Debug)]
|
||||||
pub enum InputType {
|
pub enum InputType {
|
||||||
Text,
|
Text,
|
||||||
Number,
|
Signed,
|
||||||
Password,
|
Password,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user