fix buttons/form scrolling issue

embed
Manos Pitsidianakis 2019-02-25 12:03:12 +02:00
parent c135650018
commit 7a0223c9b3
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 3 additions and 3 deletions

View File

@ -121,6 +121,9 @@ impl Component for FormWidget {
}
match event.event_type {
UIEventType::Input(Key::Up) if self.focus == FormFocus::Buttons => {
self.focus = FormFocus::Fields;
},
UIEventType::Input(Key::Up) => {
self.cursor = self.cursor.saturating_sub(1);
},
@ -137,9 +140,6 @@ impl Component for FormWidget {
event_type: UIEventType::ChangeMode(UIMode::Insert),
});
},
UIEventType::Input(Key::Up) if self.focus == FormFocus::Buttons => {
self.focus = FormFocus::Fields;
},
UIEventType::InsertInput(Key::Right) if self.focus == FormFocus::TextInput => {
if self.cursors[self.cursor] < self.fields[&self.layout[self.cursor]].len().saturating_sub(1) {
self.cursors[self.cursor] += 1;