rubytext 0.0.59 → 0.0.60

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
  SHA256:
3
- metadata.gz: 8f8330fa741d256b48ed3559124508c36f2eb0ce4e5245115f424e8dcfe08797
4
- data.tar.gz: c731e08a2416817cdebbe49a46af1dbd3154da74623ae96331d6285cfa5f36b3
3
+ metadata.gz: ed8fcf2a8a7d86a9bf6638f1cd79c5c17c3529098a38a068bb13ed46e5593064
4
+ data.tar.gz: 15151447c9e3d9cc3f512e3633587a619c9964243145fbbd351725f0513caedf
5
5
  SHA512:
6
- metadata.gz: 909bb2fb380a44b70687503870515c10f919b32f0400411e102b149448a9453313f805c8365674e4381e3eb890e01595470a39d8d3d90724e6a506adb473bd67
7
- data.tar.gz: 453a1a446750d0058a89e9a5e0dfcdc01364a17712129fee823dadfd612fc30c169d2a9c175fe4ac36a1fec4053a9dfe55c72f00184d2374e89efb7c9ea239ef
6
+ metadata.gz: 2b568b4c93804d87ed8b2a594ea384fbe055d7b0fdee9eecaa242f3991b8f764f907d2024a6669b89bed4a7122a25dc0f2fcbed9b1b586f95300267a239caa30
7
+ data.tar.gz: 19dc65ee79dc0bf985a98631f0eef878c02c263be11664f2c94f75b43bc784a51bad9f59d7ec78dbb3401e0d1d5a65562eda7f12200d2ab4ef1451a471c68eca
data/lib/settings.rb CHANGED
@@ -99,8 +99,8 @@ module RubyText
99
99
  end
100
100
  end
101
101
 
102
- def self.window(high, wide, r0, c0, border: true, fg: nil, bg: nil)
103
- RubyText::Window.new(high, wide, r0, c0, border, fg, bg)
102
+ def self.window(high, wide, r0, c0, border: true, fg: nil, bg: nil, scroll: false)
103
+ RubyText::Window.new(high, wide, r0, c0, border, fg, bg, scroll)
104
104
  end
105
105
 
106
106
  def self.hide_cursor
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  module RubyText
3
- VERSION = "0.0.59"
3
+ VERSION = "0.0.60"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
data/lib/window.rb CHANGED
@@ -4,12 +4,13 @@ class RubyText::Window
4
4
  attr_reader :win, :rows, :cols, :width, :height
5
5
  attr_writer :fg, :bg
6
6
 
7
- def initialize(high=nil, wide=nil, r0=1, c0=1, border=false, fg=nil, bg=nil)
7
+ # Better to use Window.window IRL
8
+
9
+ def initialize(high=nil, wide=nil, r0=1, c0=1, border=false, fg=nil, bg=nil, scroll=false)
8
10
  debug "RT::Win.init: #{[high, wide, r0, c0, border]}"
9
11
  @wide, @high, @r0, @c0 = wide, high, r0, c0
10
12
  @border, @fg, @bg = border, fg, bg
11
13
  @win = X::Window.new(high, wide, r0, c0)
12
- # @win.scrollok(true)
13
14
  debug "outer = #{@win.inspect}"
14
15
  debug "@border = #@border"
15
16
  debug "Calling 'colors': #{[@win, fg, bg]}"
@@ -19,23 +20,24 @@ class RubyText::Window
19
20
  @outer = @win
20
21
  @outer.refresh
21
22
  debug "About to call again: params = #{[high-2, wide-2, r0+1, c0+1]}"
22
- @win = X::Window.new(high-2, wide-2, r0+1, c0+1) # , false, fg, bg) # relative now??
23
+ @win = X::Window.new(high-2, wide-2, r0+1, c0+1)
23
24
  RubyText::Window.colors!(@win, fg, bg)
24
25
  else
25
26
  @outer = @win
26
27
  end
27
28
  @rows, @cols = @win.maxy, @win.maxx # unnecessary really...
28
29
  @width, @height = @cols + 2, @rows + 2 if @border
30
+ @win.scrollok(true) if scroll
29
31
  @win.refresh
30
32
  end
31
33
 
32
- def self.main(fg: nil, bg: nil)
34
+ def self.main(fg: nil, bg: nil, scroll: false)
33
35
  @main_win = X.init_screen
34
36
  X.start_color
35
37
  colors!(@main_win, fg, bg)
36
38
  rows, cols = @main_win.maxy, @main_win.maxx
37
39
  @screen = self.make(@main_win, rows, cols, 0, 0, false,
38
- fg: fg, bg: bg)
40
+ fg: fg, bg: bg, scroll: scroll)
39
41
  # FIXME Why is this hard to inline?
40
42
  # @win = @main_win
41
43
  # obj = self.allocate
@@ -52,7 +54,7 @@ class RubyText::Window
52
54
  @screen
53
55
  end
54
56
 
55
- def self.make(cwin, high, wide, r0, c0, border, fg: White, bg: Black)
57
+ def self.make(cwin, high, wide, r0, c0, border, fg: White, bg: Black, scroll: false)
56
58
  obj = self.allocate
57
59
  obj.instance_eval do
58
60
  # debug " Inside instance_eval..."
@@ -66,8 +68,23 @@ class RubyText::Window
66
68
  obj
67
69
  end
68
70
 
71
+ def scrolling
72
+ @win.scrollok(true)
73
+ end
74
+
75
+ def noscroll
76
+ @win.scrollok(false)
77
+ end
78
+
69
79
  def scroll(n=1)
70
- n.times { @win.scroll }
80
+ n.times do |i|
81
+ @win.scroll
82
+ go(@rows-1, 0)
83
+ noscroll
84
+ print(' '*@cols)
85
+ scrolling
86
+ left!
87
+ end
71
88
  @win.refresh
72
89
  end
73
90
 
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.59
4
+ version: 0.0.60
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-26 00:00:00.000000000 Z
11
+ date: 2018-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses