From 558f0562294177f12af2703d3f3bea69f45e1f4f Mon Sep 17 00:00:00 2001 From: correabuscar Date: Thu, 11 Apr 2024 10:43:43 +0200 Subject: [PATCH] make it work with ncurses-rs v6 but ncurses-rs needs the changes in this PR first: https://github.com/jeaye/ncurses-rs/pull/218 (except the .gitignore and build.rs changes from there) --- cursive/Cargo.toml | 2 +- cursive/src/backends/curses/n.rs | 34 ++++++++++++++++---------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/cursive/Cargo.toml b/cursive/Cargo.toml index 79365e4b..4984d574 100644 --- a/cursive/Cargo.toml +++ b/cursive/Cargo.toml @@ -33,7 +33,7 @@ version = "2" [dependencies.ncurses] features = ["wide"] optional = true -version = "5.99.0" +version = "6" [dependencies.pancurses] features = ["wide"] diff --git a/cursive/src/backends/curses/n.rs b/cursive/src/backends/curses/n.rs index ac571b78..d9f63896 100644 --- a/cursive/src/backends/curses/n.rs +++ b/cursive/src/backends/curses/n.rs @@ -353,28 +353,28 @@ impl backend::Backend for Backend { fn set_effect(&self, effect: Effect) { let style = match effect { - Effect::Reverse => ncurses::A_REVERSE(), - Effect::Simple => ncurses::A_NORMAL(), - Effect::Dim => ncurses::A_DIM(), - Effect::Bold => ncurses::A_BOLD(), - Effect::Blink => ncurses::A_BLINK(), - Effect::Italic => ncurses::A_ITALIC(), - Effect::Strikethrough => ncurses::A_NORMAL(), - Effect::Underline => ncurses::A_UNDERLINE(), + Effect::Reverse => ncurses::A_REVERSE, + Effect::Simple => ncurses::A_NORMAL, + Effect::Dim => ncurses::A_DIM, + Effect::Bold => ncurses::A_BOLD, + Effect::Blink => ncurses::A_BLINK, + Effect::Italic => ncurses::A_ITALIC, + Effect::Strikethrough => ncurses::A_NORMAL, + Effect::Underline => ncurses::A_UNDERLINE, }; ncurses::attron(style); } fn unset_effect(&self, effect: Effect) { let style = match effect { - Effect::Reverse => ncurses::A_REVERSE(), - Effect::Simple => ncurses::A_NORMAL(), - Effect::Dim => ncurses::A_DIM(), - Effect::Bold => ncurses::A_BOLD(), - Effect::Blink => ncurses::A_BLINK(), - Effect::Italic => ncurses::A_ITALIC(), - Effect::Strikethrough => ncurses::A_NORMAL(), - Effect::Underline => ncurses::A_UNDERLINE(), + Effect::Reverse => ncurses::A_REVERSE, + Effect::Simple => ncurses::A_NORMAL, + Effect::Dim => ncurses::A_DIM, + Effect::Bold => ncurses::A_BOLD, + Effect::Blink => ncurses::A_BLINK, + Effect::Italic => ncurses::A_ITALIC, + Effect::Strikethrough => ncurses::A_NORMAL, + Effect::Underline => ncurses::A_UNDERLINE, }; ncurses::attroff(style); } @@ -536,7 +536,7 @@ fn initialize_keymap() -> HashMap { } // Ncurses provides a F1 variable, but no modifiers - add_fn(ncurses::KEY_F1, Event::Key, &mut map); + add_fn(ncurses::KEY_F(1), Event::Key, &mut map); add_fn(277, Event::Shift, &mut map); add_fn(289, Event::Ctrl, &mut map); add_fn(301, Event::CtrlShift, &mut map);