Skip to content

Commit 34b5d4e

Browse files
committed
Do not use wattr_set() if wattr_get() is unavailable to avoid resetting attrs
1 parent ffcc80f commit 34b5d4e

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

ext/curses/curses.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2783,7 +2783,7 @@ window_setscrreg(VALUE obj, VALUE top, VALUE bottom)
27832783
#endif
27842784
}
27852785

2786-
#if defined(USE_COLOR) && (defined(HAVE_WCOLOR_SET) || defined(HAVE_WATTR_SET))
2786+
#if defined(USE_COLOR) && ((defined(HAVE_WATTR_SET) && defined(HAVE_WATTR_GET)) || defined(HAVE_WCOLOR_SET))
27872787
/*
27882788
* Document-method: Curses::Window.color_set
27892789
* call-seq: color_set(col)
@@ -2810,8 +2810,6 @@ window_color_set(VALUE obj, VALUE col)
28102810
return Qfalse;
28112811
return (wattr_set(winp->window, attrs, NUM2INT(col), NULL) == OK) ? Qtrue : Qfalse;
28122812
}
2813-
#elif defined(HAVE_WATTR_SET)
2814-
return (wattr_set(winp->window, 0, NUM2INT(col), NULL) == OK) ? Qtrue : Qfalse;
28152813
#else
28162814
return (wcolor_set(winp->window, NUM2INT(col), NULL) == OK) ? Qtrue : Qfalse;
28172815
#endif

0 commit comments

Comments
 (0)