curses 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1dbe3f75b839ed01f58ee7743d9d2e147491255aabc4292d04ddcf00a2eaec25
4
- data.tar.gz: 057d072c126f7d00f8f23cd6fdb246255f94545af1bdb836648b68903a1f959f
3
+ metadata.gz: 98773740f286431e80f584b518f002f79967e3d0feb014c014cf151390678f83
4
+ data.tar.gz: d8ddcced84e14aae9d4302dc69238a744a49b84ea896d957ed4968a3473da257
5
5
  SHA512:
6
- metadata.gz: 4bd61ea426ca6a68141099c8f6b734cd9094ade75fb5cb11525f285c41e6bec346e3b163bc0f37e1a29b96857ac1d2430f751f056e28641da7116c46ba458a19
7
- data.tar.gz: bd3f77e5ff14b8c9aeb86d2e498a66f53d66999f55eb81848cf953946a10f242d906b2047eb8e342f0149a436766c810d53c3c06ee942e69d3ae20068e3c8e14
6
+ metadata.gz: 2c46c4bf0ef3650a99b4e60594cda3c256ee073474de36007d2e75317131012a10b8780c2fac5d49ac744077c3773ad35e6fc52640bb28697220b30fcf040246
7
+ data.tar.gz: 517af7136762c1e146dcfcb4a10005f016290d0d3ca16355e093e158d320300699215571dd692dc1e85648c2b94430df0ded25b67d1df7f438d46e19748a7585
@@ -6,7 +6,7 @@ jobs:
6
6
  test:
7
7
  strategy:
8
8
  matrix:
9
- ruby: [ head, 2.7, 2.6, 2.5 ]
9
+ ruby: [ head, 3.1, 2.7, 2.6 ]
10
10
  runs-on: ubuntu-latest
11
11
  steps:
12
12
  - uses: actions/checkout@v2
@@ -7,7 +7,7 @@ jobs:
7
7
  runs-on: windows-latest
8
8
  strategy:
9
9
  matrix:
10
- ruby: [ 'mingw', 'mswin', '2.7', '2.6', '2.5' ]
10
+ ruby: [ 'mingw', 'mswin', '2.7', '2.6' ]
11
11
  steps:
12
12
  - uses: actions/checkout@v2
13
13
  with:
data/History.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### 1.4.3 / 2022-01-06
2
+
3
+ New features:
4
+
5
+ * Added flushinp, menu mark, fore and back functions.
6
+ Pull request #66 by Isty001.
7
+
1
8
  ### 1.4.2 / 2021-06-14
2
9
 
3
10
  New features:
data/curses.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new { |s|
2
2
  s.name = "curses"
3
- s.version = "1.4.2"
3
+ s.version = "1.4.3"
4
4
  s.author = ["Shugo Maeda", 'Eric Hodel']
5
5
  s.email = ["shugo@ruby-lang.org", 'drbrain@segment7.net']
6
6
  s.homepage = "https://github.com/ruby/curses"
@@ -9,7 +9,7 @@ Gem::Specification.new { |s|
9
9
  s.files = `git ls-files --recurse-submodules -z`.split("\x0")
10
10
  s.extensions = ["ext/curses/extconf.rb"]
11
11
  s.require_path = "lib"
12
- s.required_ruby_version = Gem::Requirement.new('>= 2.1.0')
12
+ s.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
13
13
  s.licenses = ['Ruby', 'BSD-2-Clause']
14
14
  s.add_development_dependency 'bundler'
15
15
  s.add_development_dependency 'rake'
data/ext/curses/curses.c CHANGED
@@ -620,6 +620,20 @@ curses_nonl(VALUE obj)
620
620
  return Qnil;
621
621
  }
622
622
 
623
+ /*
624
+ * Document-method: Curses.flushinp
625
+ *
626
+ * The flushinp routine throws away any typeahead that has been
627
+ * typed by the user and has not yet been read by the program.
628
+ */
629
+ static VALUE
630
+ curses_flushinp(VALUE obj)
631
+ {
632
+ curses_stdscr();
633
+ flushinp();
634
+ return Qnil;
635
+ }
636
+
623
637
  /*
624
638
  * Document-method: Curses.beep
625
639
  *
@@ -3618,6 +3632,121 @@ menu_set_format(VALUE obj, VALUE rows, VALUE cols)
3618
3632
  return obj;
3619
3633
  }
3620
3634
 
3635
+ /*
3636
+ * Document-method: Curses::Menu#mark=
3637
+ *
3638
+ * call-seq:
3639
+ * mark=(str)
3640
+ *
3641
+ * Set the mark string to distinguish the selected items
3642
+ */
3643
+ static VALUE
3644
+ menu_set_mark(VALUE obj, VALUE mark)
3645
+ {
3646
+ struct menudata *menup;
3647
+
3648
+ GetMENU(obj, menup);
3649
+ set_menu_mark(menup->menu, StringValueCStr(mark));
3650
+
3651
+ return obj;
3652
+ }
3653
+
3654
+ /*
3655
+ * Document-method: Curses::Menu#mark
3656
+ *
3657
+ * call-seq:
3658
+ * mark
3659
+ *
3660
+ * Get the Menu's mark string
3661
+ */
3662
+ static VALUE
3663
+ menu_get_mark(VALUE obj)
3664
+ {
3665
+ struct menudata *menup;
3666
+ const char *mark;
3667
+
3668
+ GetMENU(obj, menup);
3669
+ mark = menu_mark(menup->menu);
3670
+
3671
+ return rb_external_str_new_with_enc(mark, strlen(mark), terminal_encoding);
3672
+ }
3673
+
3674
+ /*
3675
+ * Document-method: Curses::Menu#fore=
3676
+ *
3677
+ * call-seq:
3678
+ * fore=(attr)
3679
+ *
3680
+ * Sets the foreground attribute of menu.
3681
+ * This is the highlight used for selected menu items.
3682
+ */
3683
+ static VALUE
3684
+ menu_set_fore(VALUE obj, VALUE attr)
3685
+ {
3686
+ struct menudata *menup;
3687
+
3688
+ GetMENU(obj, menup);
3689
+ set_menu_fore(menup->menu, NUM2CHTYPE(attr));
3690
+
3691
+ return attr;
3692
+ }
3693
+
3694
+ /*
3695
+ * Document-method: Curses::Menu#fore
3696
+ *
3697
+ * call-seq:
3698
+ * fore
3699
+ *
3700
+ * Sets the foreground attribute of menu.
3701
+ * This is the highlight used for selected menu items.
3702
+ */
3703
+ static VALUE
3704
+ menu_get_fore(VALUE obj, VALUE attr)
3705
+ {
3706
+ struct menudata *menup;
3707
+
3708
+ GetMENU(obj, menup);
3709
+
3710
+ return CHTYPE2NUM(menu_fore(menup->menu));
3711
+ }
3712
+
3713
+ /*
3714
+ * Document-method: Curses::Menu#set_back
3715
+ *
3716
+ * call-seq:
3717
+ * set_back(attr)
3718
+ *
3719
+ * Get the background attribute of menu.
3720
+ */
3721
+ static VALUE
3722
+ menu_set_back(VALUE obj, VALUE attr)
3723
+ {
3724
+ struct menudata *menup;
3725
+
3726
+ GetMENU(obj, menup);
3727
+ CHTYPE2NUM(set_menu_back(menup->menu, NUM2CHTYPE(attr)));
3728
+
3729
+ return attr;
3730
+ }
3731
+
3732
+ /*
3733
+ * Document-method: Curses::Menu#back
3734
+ *
3735
+ * call-seq:
3736
+ * back
3737
+ *
3738
+ * Get the background attribute of menu.
3739
+ */
3740
+ static VALUE
3741
+ menu_get_back(VALUE obj, VALUE attr)
3742
+ {
3743
+ struct menudata *menup;
3744
+
3745
+ GetMENU(obj, menup);
3746
+
3747
+ return CHTYPE2NUM(menu_back(menup->menu));
3748
+ }
3749
+
3621
3750
  /*
3622
3751
  * Document-method: Curses::Menu#format
3623
3752
  *
@@ -4753,6 +4882,7 @@ Init_curses(void)
4753
4882
  rb_define_module_function(mCurses, "nocrmode", curses_nocbreak, 0);
4754
4883
  rb_define_module_function(mCurses, "nl", curses_nl, 0);
4755
4884
  rb_define_module_function(mCurses, "nonl", curses_nonl, 0);
4885
+ rb_define_module_function(mCurses, "flushinp", curses_flushinp, 0);
4756
4886
  rb_define_module_function(mCurses, "beep", curses_beep, 0);
4757
4887
  rb_define_module_function(mCurses, "flash", curses_flash, 0);
4758
4888
  rb_define_module_function(mCurses, "ungetch", curses_ungetch, 1);
@@ -4988,6 +5118,12 @@ Init_curses(void)
4988
5118
  rb_define_method(cMenu, "scale", menu_scale, 0);
4989
5119
  rb_define_method(cMenu, "set_format", menu_set_format, 2);
4990
5120
  rb_define_method(cMenu, "format", menu_format_m, 0);
5121
+ rb_define_method(cMenu, "mark=", menu_set_mark, 1);
5122
+ rb_define_method(cMenu, "mark", menu_get_mark, 0);
5123
+ rb_define_method(cMenu, "fore=", menu_set_fore, 1);
5124
+ rb_define_method(cMenu, "fore", menu_get_fore, 0);
5125
+ rb_define_method(cMenu, "back=", menu_set_back, 1);
5126
+ rb_define_method(cMenu, "back", menu_get_back, 0);
4991
5127
  rb_define_method(cMenu, "set_opts", menu_set_opts, 1);
4992
5128
  rb_define_method(cMenu, "opts_on", menu_opts_on_m, 1);
4993
5129
  rb_define_method(cMenu, "opts_off", menu_opts_off_m, 1);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curses
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shugo Maeda
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-06-14 00:00:00.000000000 Z
12
+ date: 2022-01-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -332,14 +332,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
332
332
  requirements:
333
333
  - - ">="
334
334
  - !ruby/object:Gem::Version
335
- version: 2.1.0
335
+ version: 2.6.0
336
336
  required_rubygems_version: !ruby/object:Gem::Requirement
337
337
  requirements:
338
338
  - - ">="
339
339
  - !ruby/object:Gem::Version
340
340
  version: '0'
341
341
  requirements: []
342
- rubygems_version: 3.3.0.dev
342
+ rubygems_version: 3.4.0.dev
343
343
  signing_key:
344
344
  specification_version: 4
345
345
  summary: A Ruby binding for curses, ncurses, and PDCurses. curses is an extension