@@ -2810,6 +2810,31 @@ window_getbkgd(VALUE obj)
2810
2810
#endif
2811
2811
}
2812
2812
2813
+ /*
2814
+ * Document-method: Curses::Window.chgat
2815
+ * call-seq: chgat(n, attrs)
2816
+ *
2817
+ * Changes the attributes of a given number of characters starting at
2818
+ * the current cursor location.
2819
+ */
2820
+ static VALUE
2821
+ window_chgat (VALUE obj , VALUE n , VALUE attrs )
2822
+ {
2823
+ #ifdef HAVE_WCHGAT
2824
+ chtype a = NUM2CHTYPE (attrs );
2825
+ attr_t attr ;
2826
+ short pair ;
2827
+ struct windata * winp ;
2828
+
2829
+ GetWINDOW (obj ,winp );
2830
+ attr = a & A_ATTRIBUTES ;
2831
+ pair = PAIR_NUMBER (attr );
2832
+ return (wchgat (winp -> window , NUM2INT (n ), attr , pair , NULL ) == OK ) ? Qtrue : Qfalse ;
2833
+ #else
2834
+ return Qnil ;
2835
+ #endif
2836
+ }
2837
+
2813
2838
/*
2814
2839
* Document-method: Curses::Window.resize
2815
2840
* call-seq: resize(lines, cols)
@@ -5064,6 +5089,7 @@ Init_curses(void)
5064
5089
rb_define_method (cWindow , "bkgdset" , window_bkgdset , 1 );
5065
5090
rb_define_method (cWindow , "bkgd" , window_bkgd , 1 );
5066
5091
rb_define_method (cWindow , "getbkgd" , window_getbkgd , 0 );
5092
+ rb_define_method (cWindow , "chgat" , window_chgat , 2 );
5067
5093
5068
5094
rb_define_method (cWindow , "nodelay=" , window_nodelay , 1 );
5069
5095
rb_define_method (cWindow , "timeout=" , window_timeout , 1 );
0 commit comments