rubytext 0.0.24 → 0.0.25

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rubytext.rb +25 -25
  3. data/lib/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b67f09e356a4a6791fd17ad598b3dbabbf2d2bcb4e22c3aa3d7a44394255e183
4
- data.tar.gz: e121b61f5b8e29942bd9a807a3fea1a42c9324cce9a743a76576e3f59084f5dd
3
+ metadata.gz: bfe42d3f30f5d06e6668a824a6cda9f0ef349d4307785ce8e936b4968e1a813a
4
+ data.tar.gz: 7305d3b2d83ec1b466ee51abba9c4ce046d16a2715f3d0e4f510a4a3e9bb767b
5
5
  SHA512:
6
- metadata.gz: 5fdee3ed7ccd0a5113c58f7d7f512ca7aee795b9484c8496c940e250ad8b57e5f645e9c7d59dcb5708c6b57c59a3817e7fce857d8002453697be57f204d637fa
7
- data.tar.gz: bea38489db79ac0f1d5a6333c3965acd99f23b63c905050db894e9bd0043d02bef34517c863f86056b6515341e75046189b567685f6dc2ec8cc68e263ca00fe0
6
+ metadata.gz: 80bebaac7083f9b504874dbddd33040650cbc11eab952bbabcb3f08f31e60665ba01c506457b0c01c1aa0fe0dcae345ae7218153c5168a259387f382cfba56dd
7
+ data.tar.gz: 805fe981c7f4ba539e32537e8fb11e907b993a1e719cd39644c280a712953f121783f532ac24794db999c454de19d32f7bb462207e113e240f1c714c0b193105
data/lib/rubytext.rb CHANGED
@@ -13,12 +13,9 @@ end
13
13
  def fb2cp(fg, bg)
14
14
  fg ||= :blue
15
15
  bg ||= :white
16
- debug "Colors are: #{fg} on #{bg}"
17
16
  fg = X.const_get("COLOR_#{fg.upcase}")
18
17
  bg = X.const_get("COLOR_#{bg.upcase}")
19
- debug "Curses colors are: #{fg} on #{bg}"
20
18
  cp = $ColorPairs[[fg, bg]]
21
- debug "cp is: #{cp}"
22
19
  [fg, bg, cp]
23
20
  end
24
21
 
@@ -75,21 +72,31 @@ module RubyText
75
72
  end
76
73
 
77
74
  def self.main(fg: nil, bg: nil)
78
- debug "Entering Window.main (#{fg}, #{bg}) => "
79
75
  @main_win = X.init_screen
76
+ debug(@main_win.inspect)
80
77
  X.start_color
81
78
  colors!(@main_win, fg, bg)
82
- debug "About to call .make"
83
79
  rows, cols = @main_win.maxy, @main_win.maxx
84
80
  @screen = self.make(@main_win, rows, cols, 0, 0, false,
85
81
  fg: fg, bg: bg)
82
+ # FIXME Why is this hard to inline?
83
+ # @win = @main_win
84
+ # obj = self.allocate
85
+ # obj.instance_eval do
86
+ # @outer = @win = @main_win
87
+ # @wide, @high, @r0, @c0 = cols, rows, 0, 0
88
+ # @fg, @bg = fg, bg
89
+ # @border = false
90
+ # @rows, @cols = @high, @wide
91
+ # @width, @height = @cols + 2, @rows + 2 if @border
92
+ # end
93
+ # @win = @main_win # FIXME?
94
+ # obj
86
95
  @screen
87
96
  end
88
97
 
89
98
  def self.make(cwin, high, wide, r0, c0, border, fg: :white, bg: :black)
90
- debug "make: #{[cwin, high, wide, r0, c0, border, fg, bg]}"
91
99
  obj = self.allocate
92
- debug "Allocate returned a #{obj.class}"
93
100
  obj.instance_eval do
94
101
  debug " Inside instance_eval..."
95
102
  @outer = @win = cwin
@@ -107,29 +114,22 @@ end
107
114
 
108
115
  module RubyText
109
116
 
117
+ def self.set(*args)
118
+ args.each do |arg|
119
+ flag = arg.to_s
120
+ flag.sub!(/_/, "no")
121
+ X.send(flag)
122
+ end
123
+ end
124
+
110
125
  def self.start(*args, log: nil, fg: nil, bg: nil)
111
126
  $debug = File.new(log, "w") if log
112
127
  Object.const_set(:STDSCR, RubyText::Window.main(fg: fg, bg: bg))
113
128
  $stdscr = STDSCR
114
-
115
- debug "STDSCR has #{STDSCR.fg} on #{STDSCR.bg}"
116
- debug "fg = #{fg} is not a valid color" unless Colors.include?(fg.to_s)
117
- debug "bg = #{bg} is not a valid color" unless Colors.include?(bg.to_s)
118
129
  fg, bg, cp = fb2cp(fg, bg)
119
- X.noecho
120
- X.stdscr.keypad(true)
121
- X.cbreak # by default
122
-
123
- args.each do |arg|
124
- case arg
125
- when :raw
126
- X.raw
127
- when :echo
128
- X.echo
129
- when :noecho
130
- X.noecho
131
- end
132
- end
130
+ self.set(:_echo, :cbreak, :raw) # defaults
131
+ # X.stdscr.keypad(true)
132
+ self.set(*args) # override defaults
133
133
  end
134
134
 
135
135
  # For passing through arbitrary method calls
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  module RubyText
3
- VERSION = "0.0.24"
3
+ VERSION = "0.0.25"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubytext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.24
4
+ version: 0.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-16 00:00:00.000000000 Z
11
+ date: 2018-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses