curses 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ffb4ca786694addf62474419a581e2df4f642340
4
- data.tar.gz: 46bc085418181e1ee2ffe5e452851bfe1226b598
3
+ metadata.gz: fd42ffddd24b08972de01756f8c09237392a11d3
4
+ data.tar.gz: bb74122d9d1c3ca14431e7332ef7ac874248c07c
5
5
  SHA512:
6
- metadata.gz: 2dfa514179c05a02749464dfd6283938460eed244ebecdc0006f0f1042c6b73b7d0064dedcd05a747f6446e3cc08fd5e99da63110d0896582f076e89febce5e4
7
- data.tar.gz: c411cf4a0a022b1f1f01edec0486f3df77280e1885f4304aa42295c7138138fc618bf8fa3c84cbaf2a7d9e4d5e1040199c3201e72581ed41f17ed1330c5b4b2d
6
+ metadata.gz: 5f6e6219093b2c87c729f4db408fb3b8e7839e358f61e6fb424d66947c4561ccce0897b8da982bafba81148ac676f85399597dfbcf8f3724e4a85bc693bb4768
7
+ data.tar.gz: 8dde4ae7c4e5327d3b496cad6ce95e7c7490f2c23ccc8f8bda3ee4fcc232ebbee02c1e11deacb9c45940bd4714ff89e0b83ace99a7f21efc3a677de0e04a723b
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # curses
2
2
 
3
+ [![Build Status](https://travis-ci.org/ruby/curses.svg?branch=master)](https://travis-ci.org/ruby/curses)
4
+ [![Build status](https://ci.appveyor.com/api/projects/status/kdvksgjo4fyd3c4m/branch/master?svg=true)](https://ci.appveyor.com/project/ruby/curses/branch/master)
5
+
3
6
  * https://github.com/ruby/curses
4
7
  * https://github.com/ruby/curses/issues
5
8
 
@@ -17,17 +20,52 @@ with the release of Ruby 2.1.0. (see [ruby/ruby@9c5b2fd][2])
17
20
 
18
21
  ## Developers
19
22
 
20
- After checking out the source, run:
23
+ After checking out the repo, run `bundle install` to install dependencies.
24
+
25
+ To compile the extension library, run `bundle exec rake compile`.
26
+
27
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `curses.gemspec`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
+
29
+ ### Cross compilation for Windows on Debian GNU/Linux based platforms
30
+
31
+ 1. Install development environment fo 32- and 64-bit Windows.
32
+
33
+ $ sudo apt-get install mingw-w64
34
+
35
+ 2. Install rake-compiler.
36
+
37
+ $ gem install rake-compiler
21
38
 
22
- $ rake newb
39
+ 3. Compile multiple versions of Ruby.
23
40
 
24
- This task will install any missing dependencies, run the tests/specs,
25
- and generate the RDoc.
41
+ $ rake-compiler cross-ruby HOST=i686-w64-mingw32 VERSION=2.2.6
42
+ $ rake-compiler cross-ruby HOST=i686-w64-mingw32 VERSION=2.3.3
43
+ $ rake-compiler cross-ruby HOST=i686-w64-mingw32 VERSION=2.4.0
44
+ $ rake-compiler cross-ruby HOST=x86_64-w64-mingw32 VERSION=2.2.6
45
+ $ rake-compiler cross-ruby HOST=x86_64-w64-mingw32 VERSION=2.3.3
46
+ $ rake-compiler cross-ruby HOST=x86_64-w64-mingw32 VERSION=2.4.0
47
+
48
+ 3. Compile PDCurses.
49
+
50
+ $ rake build:pdcurses
51
+
52
+ 5. Compile curses.gem.
53
+
54
+ $ rake RUBY_CC_VERSION=2.3.3:2.4.0 cross clean compile native gem
55
+
56
+ Binary gems are generated in pkg/.
26
57
 
27
58
  ## License
28
59
 
29
60
  curses is released under the Ruby and 2-clause BSD licenses. See COPYING for
30
61
  details.
31
62
 
63
+ Binary gems for mingw32 include a forked version of PDCurses, which is in
64
+ the public domain:
65
+
66
+ https://github.com/Bill-Gray/PDCurses
67
+
68
+ The version for Win32 console mode in the win32 subdirectory is used.
69
+
32
70
  [1]: https://bugs.ruby-lang.org/issues/8584
33
71
  [2]: https://github.com/ruby/ruby/commit/9c5b2fd8aa0fd343ad094d47a638cfd3f6ae0a81
data/ext/curses/curses.c CHANGED
@@ -73,6 +73,9 @@ static VALUE cMouseEvent;
73
73
 
74
74
  static VALUE rb_stdscr;
75
75
 
76
+ static rb_encoding *keyboard_encoding;
77
+ static rb_encoding *terminal_encoding;
78
+
76
79
  struct windata {
77
80
  WINDOW *window;
78
81
  };
@@ -250,6 +253,23 @@ curses_clear(VALUE obj)
250
253
  return Qnil;
251
254
  }
252
255
 
256
+ #ifdef HAVE_WERASE
257
+ /*
258
+ * Document-method: Curses.erase
259
+ *
260
+ * Erase the screen.
261
+ */
262
+ static VALUE
263
+ curses_erase(VALUE obj)
264
+ {
265
+ curses_stdscr();
266
+ werase(stdscr);
267
+ return Qnil;
268
+ }
269
+ #else
270
+ #define curses_erase rb_f_notimplement
271
+ #endif
272
+
253
273
  /*
254
274
  * Document-method: Curses.clrtoeol
255
275
  *
@@ -628,7 +648,7 @@ static VALUE
628
648
  curses_addstr(VALUE obj, VALUE str)
629
649
  {
630
650
  StringValue(str);
631
- str = rb_str_export_locale(str);
651
+ str = rb_str_export_to_enc(str, terminal_encoding);
632
652
  curses_stdscr();
633
653
  if (!NIL_P(str)) {
634
654
  addstr(StringValueCStr(str));
@@ -663,7 +683,7 @@ curses_getch(VALUE obj)
663
683
  if (rb_isprint(c)) {
664
684
  char ch = (char)c;
665
685
 
666
- return rb_locale_str_new(&ch, 1);
686
+ return rb_external_str_new_with_enc(&ch, 1, keyboard_encoding);
667
687
  }
668
688
  return UINT2NUM(c);
669
689
  }
@@ -696,7 +716,7 @@ curses_getstr(VALUE obj)
696
716
 
697
717
  curses_stdscr();
698
718
  rb_thread_call_without_gvl(getstr_func, rtn, RUBY_UBF_IO, 0);
699
- return rb_locale_str_new_cstr(rtn);
719
+ return rb_external_str_new_with_enc(rtn, strlen(rtn), keyboard_encoding);
700
720
  }
701
721
 
702
722
  /*
@@ -869,7 +889,8 @@ curses_setscrreg(VALUE obj, VALUE top, VALUE bottom)
869
889
  * Document-method: Curses.attroff
870
890
  * call-seq: attroff(attrs)
871
891
  *
872
- * Turns on the named attributes +attrs+ without affecting any others.
892
+ * Turns off the named attributes +attrs+
893
+ * without affecting any others.
873
894
  *
874
895
  * See also Curses::Window.attrset for additional information.
875
896
  */
@@ -885,7 +906,7 @@ curses_attroff(VALUE obj, VALUE attrs)
885
906
  * Document-method: Curses.attron
886
907
  * call-seq: attron(attrs)
887
908
  *
888
- * Turns off the named attributes +attrs+
909
+ * Turns on the named attributes +attrs+
889
910
  * without turning any other attributes on or off.
890
911
  *
891
912
  * See also Curses::Window.attrset for additional information.
@@ -1562,6 +1583,26 @@ window_clear(VALUE obj)
1562
1583
  return Qnil;
1563
1584
  }
1564
1585
 
1586
+ #ifdef HAVE_WERASE
1587
+ /*
1588
+ * Document-method: Curses::Window.erase
1589
+ *
1590
+ * Erase the window.
1591
+ */
1592
+ static VALUE
1593
+ window_erase(VALUE obj)
1594
+ {
1595
+ struct windata *winp;
1596
+
1597
+ GetWINDOW(obj, winp);
1598
+ werase(winp->window);
1599
+
1600
+ return Qnil;
1601
+ }
1602
+ #else
1603
+ #define curses_erase rb_f_notimplement
1604
+ #endif
1605
+
1565
1606
  /*
1566
1607
  * Document-method: Curses::Window.clrtoeol
1567
1608
  *
@@ -1618,6 +1659,26 @@ window_noutrefresh(VALUE obj)
1618
1659
  return Qnil;
1619
1660
  }
1620
1661
 
1662
+ #ifdef HAVE_REDRAWWIN
1663
+ /*
1664
+ * Document-method: Curses::Window.redraw
1665
+ *
1666
+ * Dedraws the entire window.
1667
+ */
1668
+ static VALUE
1669
+ window_redraw(VALUE obj)
1670
+ {
1671
+ struct windata *winp;
1672
+
1673
+ GetWINDOW(obj, winp);
1674
+ redrawwin(winp->window);
1675
+
1676
+ return Qnil;
1677
+ }
1678
+ #else
1679
+ #define window_redraw rb_f_notimplement
1680
+ #endif
1681
+
1621
1682
  /*
1622
1683
  * Document-method: Curses::Window.move
1623
1684
  * call-seq: move(y,x)
@@ -1921,7 +1982,7 @@ window_addstr(VALUE obj, VALUE str)
1921
1982
  struct windata *winp;
1922
1983
 
1923
1984
  StringValue(str);
1924
- str = rb_str_export_locale(str);
1985
+ str = rb_str_export_to_enc(str, terminal_encoding);
1925
1986
  GetWINDOW(obj, winp);
1926
1987
  waddstr(winp->window, StringValueCStr(str));
1927
1988
  }
@@ -1981,7 +2042,7 @@ window_getch(VALUE obj)
1981
2042
  if (rb_isprint(c)) {
1982
2043
  char ch = (char)c;
1983
2044
 
1984
- return rb_locale_str_new(&ch, 1);
2045
+ return rb_external_str_new_with_enc(&ch, 1, keyboard_encoding);
1985
2046
  }
1986
2047
  return UINT2NUM(c);
1987
2048
  }
@@ -2018,7 +2079,8 @@ window_getstr(VALUE obj)
2018
2079
  GetWINDOW(obj, winp);
2019
2080
  arg.win = winp->window;
2020
2081
  rb_thread_call_without_gvl(wgetstr_func, (void *)&arg, RUBY_UBF_IO, 0);
2021
- return rb_locale_str_new_cstr(arg.rtn);
2082
+ return rb_external_str_new_with_enc(arg.rtn, strlen(arg.rtn),
2083
+ keyboard_encoding);
2022
2084
  }
2023
2085
 
2024
2086
  /*
@@ -2219,7 +2281,8 @@ window_scrl(VALUE obj, VALUE n)
2219
2281
  * Document-method: Curses::Window.attroff
2220
2282
  * call-seq: attroff(attrs)
2221
2283
  *
2222
- * Turns on the named attributes +attrs+ without affecting any others.
2284
+ * Turns off the named attributes +attrs+
2285
+ * without affecting any others.
2223
2286
  *
2224
2287
  * See also Curses::Window.attrset
2225
2288
  */
@@ -2240,7 +2303,7 @@ window_attroff(VALUE obj, VALUE attrs)
2240
2303
  * Document-method: Curses::Window.attron
2241
2304
  * call-seq: attron(attrs)
2242
2305
  *
2243
- * Turns off the named attributes +attrs+
2306
+ * Turns on the named attributes +attrs+
2244
2307
  * without turning any other attributes on or off.
2245
2308
  *
2246
2309
  * See also Curses::Window.attrset
@@ -2622,6 +2685,216 @@ pad_noutrefresh(VALUE obj, VALUE pminrow, VALUE pmincol, VALUE sminrow,
2622
2685
  }
2623
2686
  #endif /* HAVE_NEWPAD */
2624
2687
 
2688
+ /*
2689
+ * Document-method: Curses.keyboard_encoding
2690
+ * call-seq: Curses.keyboard_encoding
2691
+ *
2692
+ * Returns the encoding for keyboard input.
2693
+ */
2694
+ static VALUE
2695
+ curses_get_keyboard_encoding(VALUE obj)
2696
+ {
2697
+ return rb_enc_from_encoding(keyboard_encoding);
2698
+ }
2699
+
2700
+ /*
2701
+ * Document-method: Curses.keyboard_encoding=
2702
+ * call-seq: Curses.keyboard_encoding = encoding
2703
+ *
2704
+ * Sets the encoding for keyboard input.
2705
+ */
2706
+ static VALUE
2707
+ curses_set_keyboard_encoding(VALUE obj, VALUE enc)
2708
+ {
2709
+ keyboard_encoding = rb_to_encoding(enc);
2710
+ return enc;
2711
+ }
2712
+
2713
+ /*
2714
+ * Document-method: Curses.terminal_encoding
2715
+ * call-seq: Curses.terminal_encoding
2716
+ *
2717
+ * Returns the encoding for terminal output.
2718
+ */
2719
+ static VALUE
2720
+ curses_get_terminal_encoding(VALUE obj)
2721
+ {
2722
+ return rb_enc_from_encoding(terminal_encoding);
2723
+ }
2724
+
2725
+ /*
2726
+ * Document-method: Curses.terminal_encoding=
2727
+ * call-seq: Curses.terminal_encoding = encoding
2728
+ *
2729
+ * Sets the encoding for terminal output.
2730
+ */
2731
+ static VALUE
2732
+ curses_set_terminal_encoding(VALUE obj, VALUE enc)
2733
+ {
2734
+ terminal_encoding = rb_to_encoding(enc);
2735
+ return enc;
2736
+ }
2737
+
2738
+ /*
2739
+ * Document-method: Curses.unget_char
2740
+ * call-seq: unget_char(ch)
2741
+ *
2742
+ * Places +ch+ back onto the input queue to be returned by
2743
+ * the next call to Curses.get_char etc.
2744
+ *
2745
+ * There is just one input queue for all windows.
2746
+ */
2747
+ static VALUE
2748
+ curses_unget_char(VALUE obj, VALUE ch)
2749
+ {
2750
+ #ifdef HAVE_UNGET_WCH
2751
+ ID id_ord;
2752
+ #endif
2753
+
2754
+ curses_stdscr();
2755
+ if (FIXNUM_P(ch)) {
2756
+ ungetch(NUM2UINT(ch));
2757
+ }
2758
+ else {
2759
+ StringValue(ch);
2760
+ #ifdef HAVE_UNGET_WCH
2761
+ CONST_ID(id_ord, "ord");
2762
+ unget_wch(NUM2UINT(rb_funcall(ch, id_ord, 0)));
2763
+ #else
2764
+ ungetch(NUM2UINT(ch));
2765
+ #endif
2766
+ }
2767
+ return Qnil;
2768
+ }
2769
+
2770
+ static VALUE
2771
+ keyboard_uint_chr(unsigned int ch)
2772
+ {
2773
+ return rb_enc_uint_chr(ch, keyboard_encoding);
2774
+ }
2775
+
2776
+ #ifdef HAVE_GET_WCH
2777
+ struct get_wch_arg {
2778
+ int retval;
2779
+ wint_t ch;
2780
+ };
2781
+
2782
+ static void *
2783
+ get_wch_func(void *_arg)
2784
+ {
2785
+ struct get_wch_arg *arg = (struct get_wch_arg *) _arg;
2786
+ arg->retval = get_wch(&arg->ch);
2787
+ return 0;
2788
+ }
2789
+ #endif
2790
+
2791
+ /*
2792
+ * Document-method: Curses.get_char
2793
+ *
2794
+ * Read and returns a character or function key from the window.
2795
+ * A single or multibyte character is represented by a String, and
2796
+ * a function key is represented by an Integer.
2797
+ * Returns nil if no input is ready.
2798
+ *
2799
+ * See Curses::Key to all the function KEY_* available
2800
+ *
2801
+ */
2802
+ static VALUE
2803
+ curses_get_char(VALUE obj)
2804
+ {
2805
+ #ifdef HAVE_GET_WCH
2806
+ struct get_wch_arg arg;
2807
+
2808
+ curses_stdscr();
2809
+ rb_thread_call_without_gvl(get_wch_func, &arg, RUBY_UBF_IO, 0);
2810
+ switch (arg.retval) {
2811
+ case OK:
2812
+ return keyboard_uint_chr(arg.ch);
2813
+ case KEY_CODE_YES:
2814
+ return UINT2NUM(arg.ch);
2815
+ }
2816
+ return Qnil;
2817
+ #else
2818
+ int c;
2819
+
2820
+ curses_stdscr();
2821
+ rb_thread_call_without_gvl(getch_func, &c, RUBY_UBF_IO, 0);
2822
+ if (c > 0xff) {
2823
+ return INT2NUM(c);
2824
+ }
2825
+ else if (c >= 0) {
2826
+ return keyboard_uint_chr(c);
2827
+ }
2828
+ else {
2829
+ return Qnil;
2830
+ }
2831
+ #endif
2832
+ }
2833
+
2834
+
2835
+ #ifdef HAVE_WGET_WCH
2836
+ struct wget_wch_arg {
2837
+ WINDOW *win;
2838
+ int retval;
2839
+ wint_t ch;
2840
+ };
2841
+
2842
+ static void *
2843
+ wget_wch_func(void *_arg)
2844
+ {
2845
+ struct wget_wch_arg *arg = (struct wget_wch_arg *) _arg;
2846
+ arg->retval = wget_wch(arg->win, &arg->ch);
2847
+ return 0;
2848
+ }
2849
+ #endif
2850
+
2851
+ /*
2852
+ * Document-method: Curses::Window.get_char
2853
+ *
2854
+ * Read and returns a character or function key from the window.
2855
+ * A single or multibyte character is represented by a String, and
2856
+ * a function key is represented by an Integer.
2857
+ * Returns nil if no input is ready.
2858
+ *
2859
+ * See Curses::Key to all the function KEY_* available
2860
+ *
2861
+ */
2862
+ static VALUE
2863
+ window_get_char(VALUE obj)
2864
+ {
2865
+ #ifdef HAVE_WGET_WCH
2866
+ struct windata *winp;
2867
+ struct wget_wch_arg arg;
2868
+
2869
+ GetWINDOW(obj, winp);
2870
+ arg.win = winp->window;
2871
+ rb_thread_call_without_gvl(wget_wch_func, &arg, RUBY_UBF_IO, 0);
2872
+ switch (arg.retval) {
2873
+ case OK:
2874
+ return keyboard_uint_chr(arg.ch);
2875
+ case KEY_CODE_YES:
2876
+ return UINT2NUM(arg.ch);
2877
+ }
2878
+ return Qnil;
2879
+ #else
2880
+ struct windata *winp;
2881
+ struct wgetch_arg arg;
2882
+
2883
+ GetWINDOW(obj, winp);
2884
+ arg.win = winp->window;
2885
+ rb_thread_call_without_gvl(wgetch_func, (void *)&arg, RUBY_UBF_IO, 0);
2886
+ if (arg.c > 0xff) {
2887
+ return INT2NUM(arg.c);
2888
+ }
2889
+ else if (arg.c >= 0) {
2890
+ return keyboard_uint_chr(arg.c);
2891
+ }
2892
+ else {
2893
+ return Qnil;
2894
+ }
2895
+ #endif
2896
+ }
2897
+
2625
2898
  /*------------------------- Initialization -------------------------*/
2626
2899
 
2627
2900
  /*
@@ -2656,6 +2929,8 @@ pad_noutrefresh(VALUE obj, VALUE pminrow, VALUE pmincol, VALUE sminrow,
2656
2929
  void
2657
2930
  Init_curses(void)
2658
2931
  {
2932
+ keyboard_encoding = terminal_encoding = rb_locale_encoding();
2933
+
2659
2934
  mCurses = rb_define_module("Curses");
2660
2935
 
2661
2936
  /*
@@ -2707,6 +2982,7 @@ Init_curses(void)
2707
2982
  rb_define_module_function(mCurses, "refresh", curses_refresh, 0);
2708
2983
  rb_define_module_function(mCurses, "doupdate", curses_doupdate, 0);
2709
2984
  rb_define_module_function(mCurses, "clear", curses_clear, 0);
2985
+ rb_define_module_function(mCurses, "erase", curses_erase, 0);
2710
2986
  rb_define_module_function(mCurses, "clrtoeol", curses_clrtoeol, 0);
2711
2987
  rb_define_module_function(mCurses, "echo", curses_echo, 0);
2712
2988
  rb_define_module_function(mCurses, "noecho", curses_noecho, 0);
@@ -2770,6 +3046,12 @@ Init_curses(void)
2770
3046
  rb_define_module_function(mCurses, "timeout=", curses_timeout, 1);
2771
3047
  rb_define_module_function(mCurses, "def_prog_mode", curses_def_prog_mode, 0);
2772
3048
  rb_define_module_function(mCurses, "reset_prog_mode", curses_reset_prog_mode, 0);
3049
+ rb_define_module_function(mCurses, "keyboard_encoding", curses_get_keyboard_encoding, 0);
3050
+ rb_define_module_function(mCurses, "keyboard_encoding=", curses_set_keyboard_encoding, 1);
3051
+ rb_define_module_function(mCurses, "terminal_encoding", curses_get_terminal_encoding, 0);
3052
+ rb_define_module_function(mCurses, "terminal_encoding=", curses_set_terminal_encoding, 1);
3053
+ rb_define_module_function(mCurses, "unget_char", curses_unget_char, 1);
3054
+ rb_define_module_function(mCurses, "get_char", curses_get_char, 0);
2773
3055
 
2774
3056
  {
2775
3057
  VALUE version;
@@ -2808,23 +3090,23 @@ Init_curses(void)
2808
3090
  *
2809
3091
  * == Usage
2810
3092
  *
2811
- * require 'curses'
3093
+ * require "curses"
2812
3094
  *
2813
- * Curses.init_screen()
3095
+ * Curses.init_screen
2814
3096
  *
2815
3097
  * my_str = "LOOK! PONIES!"
2816
- * bwin = Curses::Window.new( 10, (my_str.length + 10),
2817
- * (Curses.lines - 10) / 2,
2818
- * (Curses.cols - (my_str.length + 10)) / 2 )
3098
+ *
3099
+ * height, width = 12, my_str.length + 10
3100
+ * top, left = (Curses.lines - height) / 2, (Curses.cols - width) / 2
3101
+ * bwin = Curses::Window.new(height, width, top, left)
2819
3102
  * bwin.box("\\", "/")
2820
3103
  * bwin.refresh
2821
- * win = bwin.subwin( 6, my_str.length + 6,
2822
- * (Curses.lines - 6) / 2,
2823
- * (Curses.cols - (my_str.length + 6)) / 2 )
2824
- * win.setpos(2,3)
3104
+ *
3105
+ * win = bwin.subwin(height - 4, width - 4, top + 2, left + 2)
3106
+ * win.setpos(2, 3)
2825
3107
  * win.addstr(my_str)
2826
3108
  * # or even
2827
- * win << "\nORLY"
3109
+ * win << "\nOH REALLY?"
2828
3110
  * win << "\nYES!! " + my_str
2829
3111
  * win.refresh
2830
3112
  * win.getch
@@ -2837,9 +3119,11 @@ Init_curses(void)
2837
3119
  rb_define_method(cWindow, "subwin", window_subwin, 4);
2838
3120
  rb_define_method(cWindow, "close", window_close, 0);
2839
3121
  rb_define_method(cWindow, "clear", window_clear, 0);
3122
+ rb_define_method(cWindow, "erase", window_erase, 0);
2840
3123
  rb_define_method(cWindow, "clrtoeol", window_clrtoeol, 0);
2841
3124
  rb_define_method(cWindow, "refresh", window_refresh, 0);
2842
3125
  rb_define_method(cWindow, "noutrefresh", window_noutrefresh, 0);
3126
+ rb_define_method(cWindow, "redraw", window_redraw, 0);
2843
3127
  rb_define_method(cWindow, "box", window_box, -1);
2844
3128
  rb_define_method(cWindow, "move", window_move, 2);
2845
3129
  rb_define_method(cWindow, "setpos", window_setpos, 2);
@@ -2883,6 +3167,8 @@ Init_curses(void)
2883
3167
  rb_define_method(cWindow, "nodelay=", window_nodelay, 1);
2884
3168
  rb_define_method(cWindow, "timeout=", window_timeout, 1);
2885
3169
 
3170
+ rb_define_method(cWindow, "get_char", window_get_char, 0);
3171
+
2886
3172
  #ifdef HAVE_NEWPAD
2887
3173
  /*
2888
3174
  * Document-class: Curses::Pad