Skip to content

Commit

Permalink
fix: Color pair chtype size
Browse files Browse the repository at this point in the history
  • Loading branch information
ignlg committed Mar 29, 2020
1 parent 58cc1d6 commit f560e80
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ description = """
Write code already written. Fake code editor that writes
real code, probably yours, no matter which key you stroke.
"""
version = "0.6.0"
version = "0.6.1"
authors = ["Ignacio Lago <ignacio@ignaciolago.com>"]
edition = "2018"
homepage = "https://github.com/ignlg/lazy_hacker_editor"
repository = "https://github.com/ignlg/lazy_hacker_editor"
readme = "README.md"
license = "GPL-3.0-or-later"
license-file = "LICENSE.md"
keywords = [
"lazy",
"hacker",
Expand Down
11 changes: 6 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use pancurses::chtype;
use pancurses::{
endwin, has_colors, init_pair, initscr, noecho, resize_term, start_color, Input, Window,
A_BOLD, A_NORMAL, COLOR_BLACK, COLOR_BLUE, COLOR_CYAN, COLOR_GREEN, COLOR_MAGENTA, COLOR_PAIR,
Expand Down Expand Up @@ -69,8 +70,8 @@ const COLOR_TABLE: [i16; 8] = [
COLOR_WHITE,
];

const COLOR_TEXT: u32 = 1;
const COLOR_HIGHLIGHT: u32 = 2;
const COLOR_TEXT: usize = 1;
const COLOR_HIGHLIGHT: usize = 2;

/// Initializes pancurses window
fn init_window(opt: &Opt) -> Window {
Expand All @@ -90,7 +91,7 @@ fn init_window(opt: &Opt) -> Window {
COLOR_TABLE[opt.hcolor % 8],
COLOR_BLACK,
);
window.attrset(COLOR_PAIR(COLOR_TEXT) | A_NORMAL);
window.attrset(COLOR_PAIR(COLOR_TEXT as chtype) | A_NORMAL);
window
}

Expand All @@ -100,9 +101,9 @@ fn add_text(slice: &str, window: &Window, highlight: bool) {
// char by char, highlighting
for c in slice.chars() {
if HIGHLIGHT_CHARS.contains(&c) {
window.attrset(COLOR_PAIR(COLOR_HIGHLIGHT) | A_BOLD);
window.attrset(COLOR_PAIR(COLOR_HIGHLIGHT as chtype) | A_BOLD);
} else {
window.attrset(COLOR_PAIR(COLOR_TEXT) | A_NORMAL);
window.attrset(COLOR_PAIR(COLOR_TEXT as chtype) | A_NORMAL);
}
window.addch(c);
}
Expand Down

0 comments on commit f560e80

Please sign in to comment.