Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use NUM2CHTYPE()/CHTYPE2NUM() in window_attron/attroff/attrset/color_pair? #76

Open
bashirley opened this issue Aug 28, 2022 · 0 comments

Comments

@bashirley
Copy link

Hi, on mingw Ruby26-x64, on Windows 7, using curses-1.4.4 and the statically-linked default PDCurses, attron(color_pair(n)) doesn't have any effect, and I only get the default gray-on-black, from this example:

require 'curses'
include Curses
init_screen
start_color
init_pair(6, COLOR_BLUE, COLOR_RED)
attron(color_pair(6)) do
  setpos(5,5)
  addstr('this should be in blue on red')
end
getch
close_screen

It looks like PDCurses is compiled in 64-bit chtype mode by default, and the color bits are shifting off the end of a regular 32-bit long and getting truncated in window_attron(), window_attroff(), window_attrset(), and curses_color_pair() by the INT2FIX()/NUM2INT() macros.

Replacing these macros with NUM2CHTYPE() and CHTYPE2NUM() in the color/attr functions seems to resolve the problem and the example above works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant