mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Rustfmt
This commit is contained in:
parent
2f0f632e22
commit
92f919978c
@ -30,7 +30,7 @@ fn main() {
|
|||||||
.child(TextView::new(text).scrollable())
|
.child(TextView::new(text).scrollable())
|
||||||
.fixed_width(30),
|
.fixed_width(30),
|
||||||
).button("Quit", |s| s.quit())
|
).button("Quit", |s| s.quit())
|
||||||
.h_align(HAlign::Center),
|
.h_align(HAlign::Center),
|
||||||
);
|
);
|
||||||
|
|
||||||
siv.run();
|
siv.run();
|
||||||
|
@ -23,8 +23,7 @@ fn main() {
|
|||||||
.child(Button::new_raw(" New game ", show_options))
|
.child(Button::new_raw(" New game ", show_options))
|
||||||
.child(Button::new_raw(" Best scores ", |s| {
|
.child(Button::new_raw(" Best scores ", |s| {
|
||||||
s.add_layer(Dialog::info("Not yet!").title("Scores"))
|
s.add_layer(Dialog::info("Not yet!").title("Scores"))
|
||||||
}))
|
})).child(Button::new_raw(" Exit ", |s| s.quit())),
|
||||||
.child(Button::new_raw(" Exit ", |s| s.quit())),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -43,27 +42,23 @@ fn show_options(siv: &mut Cursive) {
|
|||||||
size: Vec2::new(8, 8),
|
size: Vec2::new(8, 8),
|
||||||
mines: 10,
|
mines: 10,
|
||||||
},
|
},
|
||||||
)
|
).item(
|
||||||
.item(
|
|
||||||
"Medium: 16x16, 40 mines",
|
"Medium: 16x16, 40 mines",
|
||||||
game::Options {
|
game::Options {
|
||||||
size: Vec2::new(16, 16),
|
size: Vec2::new(16, 16),
|
||||||
mines: 40,
|
mines: 40,
|
||||||
},
|
},
|
||||||
)
|
).item(
|
||||||
.item(
|
|
||||||
"Difficult: 24x24, 99 mines",
|
"Difficult: 24x24, 99 mines",
|
||||||
game::Options {
|
game::Options {
|
||||||
size: Vec2::new(24, 24),
|
size: Vec2::new(24, 24),
|
||||||
mines: 99,
|
mines: 99,
|
||||||
},
|
},
|
||||||
)
|
).on_submit(|s, option| {
|
||||||
.on_submit(|s, option| {
|
|
||||||
s.pop_layer();
|
s.pop_layer();
|
||||||
new_game(s, *option);
|
new_game(s, *option);
|
||||||
}),
|
}),
|
||||||
)
|
).dismiss_button("Back"),
|
||||||
.dismiss_button("Back"),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,8 +271,7 @@ fn new_game(siv: &mut Cursive, options: game::Options) {
|
|||||||
.content(
|
.content(
|
||||||
LinearLayout::horizontal()
|
LinearLayout::horizontal()
|
||||||
.child(Panel::new(BoardView::new(options))),
|
.child(Panel::new(BoardView::new(options))),
|
||||||
)
|
).button("Quit game", |s| {
|
||||||
.button("Quit game", |s| {
|
|
||||||
s.pop_layer();
|
s.pop_layer();
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
@ -39,8 +39,7 @@ fn show_popup(siv: &mut Cursive) {
|
|||||||
let content = reverse(view.get_content().source());
|
let content = reverse(view.get_content().source());
|
||||||
view.set_content(content);
|
view.set_content(content);
|
||||||
});
|
});
|
||||||
})
|
}).dismiss_button("Ok"),
|
||||||
.dismiss_button("Ok"),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,8 +125,7 @@ fn final_step(s: &mut Cursive) {
|
|||||||
"Time travel was a success!\n\
|
"Time travel was a success!\n\
|
||||||
We went forward a few seconds!!",
|
We went forward a few seconds!!",
|
||||||
).center(),
|
).center(),
|
||||||
)
|
).button("That's it?", |s| s.quit()),
|
||||||
.button("That's it?", |s| s.quit()),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,8 +27,7 @@ fn main() {
|
|||||||
.on_pre_event_inner('k', |s| {
|
.on_pre_event_inner('k', |s| {
|
||||||
s.select_up(1);
|
s.select_up(1);
|
||||||
Some(EventResult::Consumed(None))
|
Some(EventResult::Consumed(None))
|
||||||
})
|
}).on_pre_event_inner('j', |s| {
|
||||||
.on_pre_event_inner('j', |s| {
|
|
||||||
s.select_down(1);
|
s.select_down(1);
|
||||||
Some(EventResult::Consumed(None))
|
Some(EventResult::Consumed(None))
|
||||||
});
|
});
|
||||||
|
@ -32,7 +32,7 @@ fn main() {
|
|||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
).title("[ 7 ]")
|
).title("[ 7 ]")
|
||||||
.with_id("dialog"),
|
.with_id("dialog"),
|
||||||
);
|
);
|
||||||
|
|
||||||
siv.run();
|
siv.run();
|
||||||
|
@ -33,15 +33,13 @@ fn main() {
|
|||||||
.on_submit(find)
|
.on_submit(find)
|
||||||
.with_id("edit")
|
.with_id("edit")
|
||||||
.min_width(10),
|
.min_width(10),
|
||||||
)
|
).button("Ok", |s| {
|
||||||
.button("Ok", |s| {
|
let text = s
|
||||||
let text =
|
.call_on_id("edit", |view: &mut EditView| {
|
||||||
s.call_on_id("edit", |view: &mut EditView| {
|
|
||||||
view.get_content()
|
view.get_content()
|
||||||
}).unwrap();
|
}).unwrap();
|
||||||
find(s, &text);
|
find(s, &text);
|
||||||
})
|
}).dismiss_button("Cancel"),
|
||||||
.dismiss_button("Cancel"),
|
|
||||||
).on_event(Event::Key(Key::Esc), |s| {
|
).on_event(Event::Key(Key::Esc), |s| {
|
||||||
s.pop_layer();
|
s.pop_layer();
|
||||||
}),
|
}),
|
||||||
|
@ -16,7 +16,7 @@ fn main() {
|
|||||||
"This application uses a \
|
"This application uses a \
|
||||||
custom theme!",
|
custom theme!",
|
||||||
)).title("Themed dialog")
|
)).title("Themed dialog")
|
||||||
.button("Quit", |s| s.quit()),
|
.button("Quit", |s| s.quit()),
|
||||||
);
|
);
|
||||||
|
|
||||||
siv.run();
|
siv.run();
|
||||||
|
@ -29,8 +29,7 @@ fn main() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
s.set_theme(theme);
|
s.set_theme(theme);
|
||||||
})
|
}).button("Quit", Cursive::quit),
|
||||||
.button("Quit", Cursive::quit),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
siv.run();
|
siv.run();
|
||||||
|
@ -112,10 +112,8 @@ fn main() {
|
|||||||
(0, 2),
|
(0, 2),
|
||||||
&format!("Speed: {}/s", convert(speed)),
|
&format!("Speed: {}/s", convert(speed)),
|
||||||
);
|
);
|
||||||
})
|
}).fixed_size((25, 3)),
|
||||||
.fixed_size((25, 3)),
|
).with(|l| {
|
||||||
)
|
|
||||||
.with(|l| {
|
|
||||||
// If we have a file length, add a progress bar
|
// If we have a file length, add a progress bar
|
||||||
if let Some(len) = len {
|
if let Some(len) = len {
|
||||||
l.add_child(
|
l.add_child(
|
||||||
|
@ -107,8 +107,7 @@ impl Backend {
|
|||||||
position: self.mouse_position,
|
position: self.mouse_position,
|
||||||
offset: Vec2::zero(),
|
offset: Vec2::zero(),
|
||||||
}
|
}
|
||||||
})
|
}).unwrap_or(Event::Unknown(vec![]))
|
||||||
.unwrap_or(Event::Unknown(vec![]))
|
|
||||||
}
|
}
|
||||||
BltEvent::ShiftReleased | BltEvent::ControlReleased => {
|
BltEvent::ShiftReleased | BltEvent::ControlReleased => {
|
||||||
Event::Refresh
|
Event::Refresh
|
||||||
@ -167,8 +166,7 @@ impl Backend {
|
|||||||
position: self.mouse_position,
|
position: self.mouse_position,
|
||||||
offset: Vec2::zero(),
|
offset: Vec2::zero(),
|
||||||
}
|
}
|
||||||
})
|
}).unwrap_or(Event::Unknown(vec![])),
|
||||||
.unwrap_or(Event::Unknown(vec![])),
|
|
||||||
KeyCode::A
|
KeyCode::A
|
||||||
| KeyCode::B
|
| KeyCode::B
|
||||||
| KeyCode::C
|
| KeyCode::C
|
||||||
|
@ -87,39 +87,33 @@ impl Default for Cursive {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(
|
#[cfg(all(
|
||||||
all(
|
not(feature = "termion-backend"),
|
||||||
not(feature = "termion-backend"),
|
feature = "pancurses-backend"
|
||||||
feature = "pancurses-backend"
|
))]
|
||||||
)
|
|
||||||
)]
|
|
||||||
impl Default for Cursive {
|
impl Default for Cursive {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::pancurses()
|
Self::pancurses()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(
|
#[cfg(all(
|
||||||
all(
|
not(feature = "termion-backend"),
|
||||||
not(feature = "termion-backend"),
|
not(feature = "pancurses-backend"),
|
||||||
not(feature = "pancurses-backend"),
|
feature = "blt-backend"
|
||||||
feature = "blt-backend"
|
))]
|
||||||
)
|
|
||||||
)]
|
|
||||||
impl Default for Cursive {
|
impl Default for Cursive {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::blt()
|
Self::blt()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(
|
#[cfg(all(
|
||||||
all(
|
not(feature = "termion-backend"),
|
||||||
not(feature = "termion-backend"),
|
not(feature = "pancurses-backend"),
|
||||||
not(feature = "pancurses-backend"),
|
not(feature = "blt-backend"),
|
||||||
not(feature = "blt-backend"),
|
feature = "ncurses-backend"
|
||||||
feature = "ncurses-backend"
|
))]
|
||||||
)
|
|
||||||
)]
|
|
||||||
impl Default for Cursive {
|
impl Default for Cursive {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::ncurses()
|
Self::ncurses()
|
||||||
|
@ -61,8 +61,8 @@ where
|
|||||||
// `current_width` is the width of everything
|
// `current_width` is the width of everything
|
||||||
// before the next token, including any space.
|
// before the next token, including any space.
|
||||||
let mut current_width = 0;
|
let mut current_width = 0;
|
||||||
let sum: usize =
|
let sum: usize = iter
|
||||||
iter.take_while(|token| {
|
.take_while(|token| {
|
||||||
let width = token.width();
|
let width = token.width();
|
||||||
if current_width + width > available_width {
|
if current_width + width > available_width {
|
||||||
false
|
false
|
||||||
@ -73,7 +73,7 @@ where
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
}).map(|token| token.len() + delimiter_len)
|
}).map(|token| token.len() + delimiter_len)
|
||||||
.sum();
|
.sum();
|
||||||
|
|
||||||
// We counted delimiter once too many times,
|
// We counted delimiter once too many times,
|
||||||
// but only if the iterator was non empty.
|
// but only if the iterator was non empty.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use With;
|
|
||||||
use vec::Vec2;
|
use vec::Vec2;
|
||||||
use view::{SizeConstraint, View, ViewWrapper};
|
use view::{SizeConstraint, View, ViewWrapper};
|
||||||
|
use With;
|
||||||
use XY;
|
use XY;
|
||||||
|
|
||||||
/// Wrapper around another view, with a controlled size.
|
/// Wrapper around another view, with a controlled size.
|
||||||
@ -202,7 +202,6 @@ impl<T: View> BoxView<T> {
|
|||||||
self.invalidated = true;
|
self.invalidated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inner_getters!(self.view: T);
|
inner_getters!(self.view: T);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,11 +406,10 @@ impl Dialog {
|
|||||||
if printer.size.x < overhead.horizontal() {
|
if printer.size.x < overhead.horizontal() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let mut offset = overhead.left
|
let mut offset = overhead.left + self
|
||||||
+ self
|
.align
|
||||||
.align
|
.h
|
||||||
.h
|
.get_offset(width, printer.size.x - overhead.horizontal());
|
||||||
.get_offset(width, printer.size.x - overhead.horizontal());
|
|
||||||
|
|
||||||
let overhead_bottom = self.padding.bottom + self.borders.bottom + 1;
|
let overhead_bottom = self.padding.bottom + self.borders.bottom + 1;
|
||||||
|
|
||||||
@ -465,10 +464,9 @@ impl Dialog {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let spacing = 3; //minimum distance to borders
|
let spacing = 3; //minimum distance to borders
|
||||||
let x = spacing
|
let x = spacing + self
|
||||||
+ self
|
.title_position
|
||||||
.title_position
|
.get_offset(len, printer.size.x - 2 * spacing);
|
||||||
.get_offset(len, printer.size.x - 2 * spacing);
|
|
||||||
printer.with_high_border(false, |printer| {
|
printer.with_high_border(false, |printer| {
|
||||||
printer.print((x - 2, 0), "┤ ");
|
printer.print((x - 2, 0), "┤ ");
|
||||||
printer.print((x + len, 0), " ├");
|
printer.print((x + len, 0), " ├");
|
||||||
@ -507,8 +505,7 @@ impl Dialog {
|
|||||||
} else if position.fits_in_rect(
|
} else if position.fits_in_rect(
|
||||||
(self.padding + self.borders).top_left(),
|
(self.padding + self.borders).top_left(),
|
||||||
self.content.size,
|
self.content.size,
|
||||||
)
|
) && self.content.take_focus(Direction::none())
|
||||||
&& self.content.take_focus(Direction::none())
|
|
||||||
{
|
{
|
||||||
// Or did we click the content?
|
// Or did we click the content?
|
||||||
self.focus = DialogFocus::Content;
|
self.focus = DialogFocus::Content;
|
||||||
|
@ -9,5 +9,7 @@ pub struct DummyView;
|
|||||||
impl View for DummyView {
|
impl View for DummyView {
|
||||||
fn draw(&self, _: &Printer) {}
|
fn draw(&self, _: &Printer) {}
|
||||||
|
|
||||||
fn needs_relayout(&self) -> bool { false }
|
fn needs_relayout(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -551,8 +551,7 @@ impl View for EditView {
|
|||||||
} else {
|
} else {
|
||||||
Some(g)
|
Some(g)
|
||||||
}
|
}
|
||||||
})
|
}).map(|g| g.len())
|
||||||
.map(|g| g.len())
|
|
||||||
.sum();
|
.sum();
|
||||||
|
|
||||||
let content = &content[..display_bytes];
|
let content = &content[..display_bytes];
|
||||||
@ -674,11 +673,10 @@ impl View for EditView {
|
|||||||
if position.fits_in_rect(offset, (self.last_length, 1)) =>
|
if position.fits_in_rect(offset, (self.last_length, 1)) =>
|
||||||
{
|
{
|
||||||
if let Some(position) = position.checked_sub(offset) {
|
if let Some(position) = position.checked_sub(offset) {
|
||||||
self.cursor = self.offset
|
self.cursor = self.offset + simple_prefix(
|
||||||
+ simple_prefix(
|
&self.content[self.offset..],
|
||||||
&self.content[self.offset..],
|
position.x,
|
||||||
position.x,
|
).length;
|
||||||
).length;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => return EventResult::Ignored,
|
_ => return EventResult::Ignored,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use view::{Selector, View, ViewWrapper};
|
|
||||||
use vec::Vec2;
|
use vec::Vec2;
|
||||||
|
use view::{Selector, View, ViewWrapper};
|
||||||
use With;
|
use With;
|
||||||
|
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
@ -100,7 +100,7 @@ impl<V: View> ViewWrapper for HideableView<V> {
|
|||||||
Ok(self.view)
|
Ok(self.view)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wrap_layout(&mut self, size: Vec2) {
|
fn wrap_layout(&mut self, size: Vec2) {
|
||||||
self.invalidated = false;
|
self.invalidated = false;
|
||||||
self.with_view_mut(|v| v.layout(size));
|
self.with_view_mut(|v| v.layout(size));
|
||||||
}
|
}
|
||||||
|
@ -234,11 +234,7 @@ impl LinearLayout {
|
|||||||
) -> Box<Iterator<Item = (usize, &mut Child)> + 'a> {
|
) -> Box<Iterator<Item = (usize, &mut Child)> + 'a> {
|
||||||
match source {
|
match source {
|
||||||
direction::Relative::Front => {
|
direction::Relative::Front => {
|
||||||
let start = if from_focus {
|
let start = if from_focus { self.focus } else { 0 };
|
||||||
self.focus
|
|
||||||
} else {
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
Box::new(self.children.iter_mut().enumerate().skip(start))
|
Box::new(self.children.iter_mut().enumerate().skip(start))
|
||||||
}
|
}
|
||||||
@ -556,25 +552,29 @@ impl View for LinearLayout {
|
|||||||
self.move_focus(direction::Direction::front())
|
self.move_focus(direction::Direction::front())
|
||||||
}
|
}
|
||||||
Event::Key(Key::Left)
|
Event::Key(Key::Left)
|
||||||
if self.orientation == direction::Orientation::Horizontal
|
if self.orientation
|
||||||
|
== direction::Orientation::Horizontal
|
||||||
&& self.focus > 0 =>
|
&& self.focus > 0 =>
|
||||||
{
|
{
|
||||||
self.move_focus(direction::Direction::right())
|
self.move_focus(direction::Direction::right())
|
||||||
}
|
}
|
||||||
Event::Key(Key::Up)
|
Event::Key(Key::Up)
|
||||||
if self.orientation == direction::Orientation::Vertical
|
if self.orientation
|
||||||
|
== direction::Orientation::Vertical
|
||||||
&& self.focus > 0 =>
|
&& self.focus > 0 =>
|
||||||
{
|
{
|
||||||
self.move_focus(direction::Direction::down())
|
self.move_focus(direction::Direction::down())
|
||||||
}
|
}
|
||||||
Event::Key(Key::Right)
|
Event::Key(Key::Right)
|
||||||
if self.orientation == direction::Orientation::Horizontal
|
if self.orientation
|
||||||
|
== direction::Orientation::Horizontal
|
||||||
&& self.focus + 1 < self.children.len() =>
|
&& self.focus + 1 < self.children.len() =>
|
||||||
{
|
{
|
||||||
self.move_focus(direction::Direction::left())
|
self.move_focus(direction::Direction::left())
|
||||||
}
|
}
|
||||||
Event::Key(Key::Down)
|
Event::Key(Key::Down)
|
||||||
if self.orientation == direction::Orientation::Vertical
|
if self.orientation
|
||||||
|
== direction::Orientation::Vertical
|
||||||
&& self.focus + 1 < self.children.len() =>
|
&& self.focus + 1 < self.children.len() =>
|
||||||
{
|
{
|
||||||
self.move_focus(direction::Direction::up())
|
self.move_focus(direction::Direction::up())
|
||||||
|
@ -150,11 +150,7 @@ impl ListView {
|
|||||||
) -> Box<Iterator<Item = (usize, &mut ListChild)> + 'a> {
|
) -> Box<Iterator<Item = (usize, &mut ListChild)> + 'a> {
|
||||||
match source {
|
match source {
|
||||||
direction::Relative::Front => {
|
direction::Relative::Front => {
|
||||||
let start = if from_focus {
|
let start = if from_focus { self.focus } else { 0 };
|
||||||
self.focus
|
|
||||||
} else {
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
Box::new(self.children.iter_mut().enumerate().skip(start))
|
Box::new(self.children.iter_mut().enumerate().skip(start))
|
||||||
}
|
}
|
||||||
|
@ -317,14 +317,11 @@ impl View for MenuPopup {
|
|||||||
position,
|
position,
|
||||||
offset,
|
offset,
|
||||||
}
|
}
|
||||||
if self.scrollbase.scrollable()
|
if self.scrollbase.scrollable() && position
|
||||||
&& position
|
.checked_sub(offset + (0, 1))
|
||||||
.checked_sub(offset + (0, 1))
|
.map(|position| {
|
||||||
.map(|position| {
|
self.scrollbase.start_drag(position, self.last_size.x)
|
||||||
self.scrollbase
|
}).unwrap_or(false) =>
|
||||||
.start_drag(position, self.last_size.x)
|
|
||||||
})
|
|
||||||
.unwrap_or(false) =>
|
|
||||||
{
|
{
|
||||||
fix_scroll = false;
|
fix_scroll = false;
|
||||||
}
|
}
|
||||||
|
@ -246,18 +246,17 @@ fn show_child(s: &mut Cursive, offset: Vec2, menu: Rc<MenuTree>) {
|
|||||||
{
|
{
|
||||||
cb(s);
|
cb(s);
|
||||||
}
|
}
|
||||||
})
|
}).on_event(Key::Left, |s| {
|
||||||
.on_event(Key::Left, |s| {
|
s.pop_layer();
|
||||||
s.pop_layer();
|
s.select_menubar();
|
||||||
s.select_menubar();
|
// Act as if we sent "Left" then "Down"
|
||||||
// Act as if we sent "Left" then "Down"
|
s.menubar().on_event(Event::Key(Key::Left)).process(s);
|
||||||
s.menubar().on_event(Event::Key(Key::Left)).process(s);
|
if let EventResult::Consumed(Some(cb)) =
|
||||||
if let EventResult::Consumed(Some(cb)) =
|
s.menubar().on_event(Event::Key(Key::Down))
|
||||||
s.menubar().on_event(Event::Key(Key::Down))
|
{
|
||||||
{
|
cb(s);
|
||||||
cb(s);
|
}
|
||||||
}
|
}),
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,8 +436,7 @@ impl<T: 'static> SelectView<T> {
|
|||||||
.checked_sub(offset)
|
.checked_sub(offset)
|
||||||
.map(|position| {
|
.map(|position| {
|
||||||
position < self.last_size && position.y < self.len()
|
position < self.last_size && position.y < self.len()
|
||||||
})
|
}).unwrap_or(false) =>
|
||||||
.unwrap_or(false) =>
|
|
||||||
{
|
{
|
||||||
self.focus.set(position.y - offset.y)
|
self.focus.set(position.y - offset.y)
|
||||||
}
|
}
|
||||||
@ -446,14 +445,11 @@ impl<T: 'static> SelectView<T> {
|
|||||||
position,
|
position,
|
||||||
offset,
|
offset,
|
||||||
}
|
}
|
||||||
if self.on_submit.is_some()
|
if self.on_submit.is_some() && position
|
||||||
&& position
|
.checked_sub(offset)
|
||||||
.checked_sub(offset)
|
.map(|position| {
|
||||||
.map(|position| {
|
position < self.last_size && position.y == self.focus()
|
||||||
position < self.last_size
|
}).unwrap_or(false) =>
|
||||||
&& position.y == self.focus()
|
|
||||||
})
|
|
||||||
.unwrap_or(false) =>
|
|
||||||
{
|
{
|
||||||
return self.submit();
|
return self.submit();
|
||||||
}
|
}
|
||||||
|
@ -559,8 +559,7 @@ impl View for TextArea {
|
|||||||
.checked_sub(offset)
|
.checked_sub(offset)
|
||||||
.map(|position| {
|
.map(|position| {
|
||||||
self.scrollbase.start_drag(position, self.last_size.x)
|
self.scrollbase.start_drag(position, self.last_size.x)
|
||||||
})
|
}).unwrap_or(false) =>
|
||||||
.unwrap_or(false) =>
|
|
||||||
{
|
{
|
||||||
fix_scroll = false;
|
fix_scroll = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user