From d6810f92e7bc3692dc7f6f4b50f4733fcc317293 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 >=6.0.1 which means that ncurses-rs already has the needed changes in this PR: https://github.com/jeaye/ncurses-rs/pull/220 and/or from this PR: https://github.com/jeaye/ncurses-rs/pull/218 --- 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 3a26f0b3..bebfc7dc 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.0.1" [dependencies.pancurses] features = ["wide"] diff --git a/cursive/src/backends/curses/n.rs b/cursive/src/backends/curses/n.rs index 14497d4b..a17c96e2 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); } @@ -529,7 +529,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);