From 00e8147473c01767a000070b9dada5c965ff92a0 Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Wed, 12 Jan 2022 14:37:27 -0500 Subject: [PATCH] Update to cursive 0.17 --- Cargo.lock | 171 ++++++++++++++++++++++--------------------- Cargo.toml | 2 +- src/app/impl_view.rs | 6 +- src/habit/traits.rs | 5 +- src/views.rs | 10 +-- 5 files changed, 98 insertions(+), 96 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 30a194a..d723a6a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,12 +1,14 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "ahash" -version = "0.6.3" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "796540673305a66d127804eef19ad696f1f204b8c1025aaca4958c17eab32877" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.1", + "getrandom 0.2.3", "once_cell", "version_check", ] @@ -20,12 +22,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "array-macro" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06e97b4e522f9e55523001238ac59d13a8603af57f69980de5d8de4bbbe8ada6" - [[package]] name = "arrayref" version = "0.3.6" @@ -63,9 +59,9 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "bitflags" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "blake2b_simd" @@ -100,7 +96,7 @@ dependencies = [ "num-integer", "num-traits", "serde", - "time", + "time 0.1.43", "winapi 0.3.9", ] @@ -148,25 +144,25 @@ dependencies = [ [[package]] name = "crossterm" -version = "0.19.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c36c10130df424b2f3552fcc2ddcd9b28a27b1e54b358b45874f88d1ca6888c" +checksum = "c85525306c4291d1b73ce93c8acf9c339f9b213aef6c1d85c3830cbf1c16325c" dependencies = [ "bitflags", "crossterm_winapi", - "lazy_static", "libc", "mio 0.7.7", "parking_lot", - "signal-hook 0.1.17", + "signal-hook", + "signal-hook-mio", "winapi 0.3.9", ] [[package]] name = "crossterm_winapi" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da8964ace4d3e4a044fd027919b2237000b24315a37c916f61809f1ff2140b9" +checksum = "2ae1b35a484aa10e07fe0638d02301c5ad24de82d310ccbd2f3693da5f09bf1c" dependencies = [ "winapi 0.3.9", ] @@ -183,9 +179,9 @@ dependencies = [ [[package]] name = "cursive" -version = "0.16.3" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6593c3409eb794bf22090bec60dda1e19d1def284478bec7e5a92da3cf977c52" +checksum = "ca536d245342f6c005e7547ab640e444a3dc2fc0319a92124c8c1cbff025e775" dependencies = [ "ahash", "cfg-if 1.0.0", @@ -195,40 +191,37 @@ dependencies = [ "lazy_static", "libc", "log", - "signal-hook 0.3.4", + "signal-hook", "termion", "unicode-segmentation", "unicode-width", - "wasmer_enumset", ] [[package]] name = "cursive_core" -version = "0.2.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "025ac0bcd21ced752d27b70e6aa2285a3513d07b5a0c7f89e71121d20ca1429d" +checksum = "e27fbda42833e46148ff28db338f6189a4407e4a38ba1f4105e2f623089e66a0" dependencies = [ "ahash", - "chrono", "crossbeam-channel", "enum-map", + "enumset", "lazy_static", - "libc", "log", "num", "owning_ref", - "syn", + "time 0.3.5", "unicode-segmentation", "unicode-width", - "wasmer_enumset", "xi-unicode", ] [[package]] name = "darling" -version = "0.10.2" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" +checksum = "5f2c43f534ea4b0b049015d00269734195e6d3f0f6635cb692251aca6f9f8b3c" dependencies = [ "darling_core", "darling_macro", @@ -236,23 +229,23 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.10.2" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" +checksum = "8e91455b86830a1c21799d94524df0845183fa55bafd9aa137b01c7d1065fa36" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.9.3", + "strsim 0.10.0", "syn", ] [[package]] name = "darling_macro" -version = "0.10.2" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" +checksum = "29b5acf0dea37a7f66f7b25d2c5e93fd46f8f6968b1a5d7a3e02e97768afc95a" dependencies = [ "darling_core", "quote", @@ -299,25 +292,45 @@ dependencies = [ [[package]] name = "enum-map" -version = "0.6.4" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4187999839f4ae8be35cf185d1381aa8dc32d2f5951349cc37ae49ebc4781855" +checksum = "9ec3484df47a85c121b9d8fbf265ca7eedc26a5c4c341db7cf800876201c766f" dependencies = [ - "array-macro", "enum-map-derive", ] [[package]] name = "enum-map-derive" -version = "0.4.6" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c450cf304c9e18d45db562025a14fb1ca0f5c769b6f609309f81d4c31de455" +checksum = "8182c0d26a908f001a23adc388fcef7fde884fbaf668874126cd5a3c13ca299e" dependencies = [ "proc-macro2", "quote", "syn", ] +[[package]] +name = "enumset" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbd795df6708a599abf1ee10eacc72efd052b7a5f70fdf0715e4d5151a6db9c3" +dependencies = [ + "enumset_derive", +] + +[[package]] +name = "enumset_derive" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e19c52f9ec503c8a68dc04daf71a04b07e690c32ab1a8b68e33897f255269d47" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "erased-serde" version = "0.3.13" @@ -393,9 +406,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4060f4657be78b8e766215b02b18a2e862d83745545de804638e2b545e81aee6" +checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ "cfg-if 1.0.0", "libc", @@ -518,9 +531,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.82" +version = "0.2.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89203f3fba0a3795506acaad8ebce3c80c0af93f994d5a1d7a0b1eeb23271929" +checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" [[package]] name = "lock_api" @@ -646,9 +659,9 @@ dependencies = [ [[package]] name = "num" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b7a8e9be5e039e2ff869df49155f1c06bd01ade2117ec783e56ab0932b67a8f" +checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" dependencies = [ "num-complex", "num-integer", @@ -659,9 +672,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" +checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085" dependencies = [ "num-traits", ] @@ -689,9 +702,9 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" +checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" dependencies = [ "autocfg", "num-integer", @@ -715,9 +728,9 @@ checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" [[package]] name = "once_cell" -version = "1.5.2" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" +checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" [[package]] name = "owning_ref" @@ -863,30 +876,30 @@ dependencies = [ [[package]] name = "signal-hook" -version = "0.1.17" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e31d442c16f047a671b5a71e2161d6e68814012b7f5379d269ebd915fac2729" +checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d" dependencies = [ "libc", - "mio 0.7.7", "signal-hook-registry", ] [[package]] -name = "signal-hook" -version = "0.3.4" +name = "signal-hook-mio" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "780f5e3fe0c66f67197236097d89de1e86216f1f6fdeaf47c442f854ab46c240" +checksum = "29fd5867f1c4f2c5be079aee7a2adf1152ebb04a4bc4d341f504b7dece607ed4" dependencies = [ "libc", - "signal-hook-registry", + "mio 0.7.7", + "signal-hook", ] [[package]] name = "signal-hook-registry" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" dependencies = [ "libc", ] @@ -928,9 +941,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "strsim" -version = "0.9.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" @@ -974,6 +987,16 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "time" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41effe7cfa8af36f439fac33861b66b049edc6f9a32331e2312660529c1c24ad" +dependencies = [ + "itoa", + "libc", +] + [[package]] name = "toml" version = "0.5.8" @@ -1060,28 +1083,6 @@ version = "0.10.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93c6c3420963c5c64bca373b25e77acb562081b9bb4dd5bb864187742186cea9" -[[package]] -name = "wasmer_enumset" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf088cc1f7d247fd96dff0df46fb1bbb747d8a69ae1ecd71aed55c55e354b2d8" -dependencies = [ - "num-traits", - "wasmer_enumset_derive", -] - -[[package]] -name = "wasmer_enumset_derive" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d1b32d98e11194200baf6d3f85eb2d6cfe56f6d9af0dd617f90ca48f958a88" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "winapi" version = "0.2.8" diff --git a/Cargo.toml b/Cargo.toml index 0be73cd..12a9b53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ toml = "0.5.6" syn = "=1.0.57" [dependencies.cursive] -version = "0.16" +version = "0.17" default-features = false [dependencies.chrono] diff --git a/src/app/impl_view.rs b/src/app/impl_view.rs index c369d8f..c0f1eb4 100644 --- a/src/app/impl_view.rs +++ b/src/app/impl_view.rs @@ -6,7 +6,7 @@ use std::path::PathBuf; use cursive::direction::{Absolute, Direction}; use cursive::event::{Event, EventResult, Key}; use cursive::theme::Color; -use cursive::view::View; +use cursive::view::{CannotFocus, View}; use cursive::{Printer, Vec2}; use notify::DebouncedEvent; @@ -53,8 +53,8 @@ impl View for App { Vec2::new(width, height + 2) } - fn take_focus(&mut self, _: Direction) -> bool { - false + fn take_focus(&mut self, _: Direction) -> Result { + Err(CannotFocus) } fn on_event(&mut self, e: Event) -> EventResult { diff --git a/src/habit/traits.rs b/src/habit/traits.rs index 54ec9e1..b17e5d2 100644 --- a/src/habit/traits.rs +++ b/src/habit/traits.rs @@ -1,6 +1,7 @@ use chrono::NaiveDate; use cursive::direction::Direction; use cursive::event::{Event, EventResult}; +use cursive::view::CannotFocus; use cursive::{Printer, Vec2}; use typetag; @@ -38,7 +39,7 @@ pub trait HabitWrapper: erased_serde::Serialize { fn on_event(&mut self, event: Event) -> EventResult; fn remaining(&self, date: NaiveDate) -> u32; fn required_size(&mut self, _: Vec2) -> Vec2; - fn take_focus(&mut self, _: Direction) -> bool; + fn take_focus(&mut self, _: Direction) -> Result; fn inner_data_ref(&self) -> &InnerData; fn inner_data_mut_ref(&mut self) -> &mut InnerData; @@ -60,7 +61,7 @@ macro_rules! auto_habit_impl { fn required_size(&mut self, x: Vec2) -> Vec2 { ShadowView::required_size(self, x) } - fn take_focus(&mut self, d: Direction) -> bool { + fn take_focus(&mut self, d: Direction) -> Result { ShadowView::take_focus(self, d) } diff --git a/src/views.rs b/src/views.rs index ca4f757..1bda8a8 100644 --- a/src/views.rs +++ b/src/views.rs @@ -1,7 +1,7 @@ use cursive::direction::Direction; use cursive::event::{Event, EventResult, Key}; use cursive::theme::{ColorStyle, Effect, Style}; -use cursive::view::View; +use cursive::view::{CannotFocus, View}; use cursive::{Printer, Vec2}; use chrono::prelude::*; @@ -16,7 +16,7 @@ use crate::CONFIGURATION; pub trait ShadowView { fn draw(&self, printer: &Printer); fn required_size(&mut self, _: Vec2) -> Vec2; - fn take_focus(&mut self, _: Direction) -> bool; + fn take_focus(&mut self, _: Direction) -> Result; fn on_event(&mut self, e: Event) -> EventResult; } @@ -151,8 +151,8 @@ where (25, 6).into() } - fn take_focus(&mut self, _: Direction) -> bool { - true + fn take_focus(&mut self, _: Direction) -> Result { + Ok(EventResult::consumed()) } fn on_event(&mut self, e: Event) -> EventResult { @@ -183,7 +183,7 @@ macro_rules! auto_view_impl { fn required_size(&mut self, x: Vec2) -> Vec2 { ShadowView::required_size(self, x) } - fn take_focus(&mut self, d: Direction) -> bool { + fn take_focus(&mut self, d: Direction) -> Result { ShadowView::take_focus(self, d) } fn on_event(&mut self, e: Event) -> EventResult {