Update for cursive-core 0.3.0

pull/10/head
Alexandre Bury 1 year ago
parent 94a1bf79d2
commit e3505e120e

@ -13,7 +13,7 @@ documentation = "https://docs.rs/cursive-async-view"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cursive_core = "0.2"
cursive_core = "0.3"
log = "0.4"
interpolation = "0.2.0"
crossbeam = "0.8"
@ -23,4 +23,4 @@ lazy_static = "1.4"
doc-comment = "0.3"
[dev-dependencies]
cursive = "0.16"
cursive = "0.17"

@ -7,7 +7,7 @@ use cursive_core::direction::Direction;
use cursive_core::event::{AnyCb, Event, EventResult};
use cursive_core::theme::PaletteColor;
use cursive_core::utils::markup::StyledString;
use cursive_core::view::{Selector, View, ViewNotFound};
use cursive_core::view::{CannotFocus, Selector, View, ViewNotFound};
use cursive_core::views::TextView;
use cursive_core::{Cursive, Printer, Rect, Vec2};
use interpolation::Ease;
@ -671,17 +671,17 @@ impl<T: View + Sized> View for AsyncView<T> {
}
}
fn focus_view(&mut self, sel: &Selector) -> Result<(), ViewNotFound> {
fn focus_view(&mut self, sel: &Selector) -> Result<EventResult, ViewNotFound> {
match self.view {
AsyncState::Available(ref mut view) => view.focus_view(sel),
_ => Err(ViewNotFound),
}
}
fn take_focus(&mut self, source: Direction) -> bool {
fn take_focus(&mut self, source: Direction) -> Result<EventResult, CannotFocus> {
match self.view {
AsyncState::Available(ref mut view) => view.take_focus(source),
_ => false,
_ => Err(CannotFocus),
}
}

@ -3,7 +3,7 @@ use cursive_core::direction::Direction;
use cursive_core::event::{AnyCb, Event, EventResult};
use cursive_core::theme::PaletteColor;
use cursive_core::utils::markup::StyledString;
use cursive_core::view::{Selector, View, ViewNotFound};
use cursive_core::view::{CannotFocus, Selector, View, ViewNotFound};
use cursive_core::views::TextView;
use cursive_core::{Cursive, Printer, Rect, Vec2};
use interpolation::Ease;
@ -555,7 +555,7 @@ impl<T: View + Sized> View for AsyncProgressView<T> {
}
}
fn focus_view(&mut self, sel: &Selector) -> Result<(), ViewNotFound> {
fn focus_view(&mut self, sel: &Selector) -> Result<EventResult, ViewNotFound> {
match &mut self.view {
AsyncProgressState::Available(v) => v.focus_view(sel),
AsyncProgressState::Error(_) | AsyncProgressState::Pending(_) => {
@ -564,7 +564,7 @@ impl<T: View + Sized> View for AsyncProgressView<T> {
}
}
fn take_focus(&mut self, source: Direction) -> bool {
fn take_focus(&mut self, source: Direction) -> Result<EventResult, CannotFocus> {
match &mut self.view {
AsyncProgressState::Available(v) => v.take_focus(source),
AsyncProgressState::Error(_) | AsyncProgressState::Pending(_) => {

Loading…
Cancel
Save