Skip to content

Commit

Permalink
make it work with ncurses-rs v6
Browse files Browse the repository at this point in the history
but ncurses-rs needs the changes in this PR first:
jeaye/ncurses-rs#218
(except the .gitignore and build.rs changes from there)
  • Loading branch information
correabuscar committed Jun 5, 2024
1 parent 85a5f87 commit 9ee9c41
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion cursive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ version = "2"
[dependencies.ncurses]
features = ["wide"]
optional = true
version = "5.99.0"
version = "6"

[dependencies.pancurses]
features = ["wide"]
Expand Down
34 changes: 17 additions & 17 deletions cursive/src/backends/curses/n.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -529,7 +529,7 @@ fn initialize_keymap() -> HashMap<i32, Event> {
}

// 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);
Expand Down

0 comments on commit 9ee9c41

Please sign in to comment.