rcurses 2.6.1 → 2.8

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: aed95a107616226e2f90aaf5db3dbfd3cddfbb905254e31115857d882741fa61
4
- data.tar.gz: ba178a044ed384e5bc3c2c53af77cc654eb96977316e1464f3b0be3e8c35694f
3
+ metadata.gz: c57e93f49709d2dc006240468b49f490abbcff381822edf82eac545de3961ebe
4
+ data.tar.gz: 92db5bb428787143a9a6bf63508a3301410ab1f06d69ac4fbb5268d33cce1887
5
5
  SHA512:
6
- metadata.gz: 1af985cfb5ecb496bcf321a4429c8b038528c8ba46191eae4e4304746e0ca61a517268342dbf4293f004553e57222f95e96fc67c78710d605ad33a57a0cfcb14
7
- data.tar.gz: 3e8232f1023544530e6728a5a1be196764e0296765eb5d3639b63b34fd645b592a49a3efcc0109dcda6597a35e5f280337a6c6e08d3602cfd588e90c39938de0
6
+ metadata.gz: ffd05a2f1fc8ad273a1e619d0a4ea892c8edd974bcb95dfd42590a969df8eeca7af8f2c675418b8beb90eb751216894539494e208d9eb566aefe2f6a8ef84ea6
7
+ data.tar.gz: cdc84b82cb1361a8132c2885905d2029290adbbaa385b53f9a02321c8d1aa84ab54bd38844114bb843c57eaaa4f63fae921fb9f10ba2720c207cc4e928d1af38
data/README.md CHANGED
@@ -81,8 +81,12 @@ edit | An editor for the Pane. When this is invoked, all existing font
81
81
  editline | Used for one-line Panes. It will print the content of the property `prompt` and then the property `text` that can then be edited by the user. Hitting `ESC` will disregard the edits, while `ENTER` will save the edited text
82
82
  puts(text) | Short form for setting panel.text, then doing a refresh of that panel
83
83
  ask(prompt,text) | Short form of setting panel.prompt, then panel.text, doing a panel.editline and then returning panel.text
84
- pagedown | Go down one page height in the text (minus one line), but not longer than the length of the text
85
- pageup | Go up one page height in the text (minus one line)
84
+ pagedown | Scroll down one page height in the text (minus one line), but not longer than the length of the text
85
+ pageup | Scroll up one page height in the text (minus one line)
86
+ linedown | Scroll down one line in the text
87
+ lineup | Scroll up one line in the text
88
+ bottom | Scroll to the bottom of the text in the pane
89
+ top | Scroll to the top of the text in the pane
86
90
 
87
91
  # class String extensions
88
92
  Method extensions provided for the class String:
@@ -164,6 +168,7 @@ Key pressed | string returned
164
168
  `end` | "END"
165
169
  `ctrl-end` | "C-END"
166
170
  `backspace` | "BACK"
171
+ `ctrl- ` | "C-SPACE"
167
172
  `ctrl-h` | "BACK"
168
173
  `ctrl-a` | "C-A"
169
174
  `ctrl-b` | "C-B"
@@ -192,6 +197,7 @@ Key pressed | string returned
192
197
  `ctrl-z` | "C-Z"
193
198
  `enter` | "ENTER"
194
199
  `tab` | "TAB"
200
+ `F1` - `F12` | "F1" - "F12"
195
201
 
196
202
  Any other character enter will be returned (to `chr` in the example above).
197
203
 
data/lib/rcurses/input.rb CHANGED
@@ -25,24 +25,83 @@ module Rcurses
25
25
  when 'C' then chr = "RIGHT"
26
26
  when 'D' then chr = "LEFT"
27
27
  when 'Z' then chr = "S-TAB"
28
+ when '1'
29
+ fourth_char = $stdin.getc
30
+ case fourth_char
31
+ when '1'
32
+ fifth_char = $stdin.getc
33
+ chr = fifth_char == '~' ? "F1" : ""
34
+ when '2'
35
+ fifth_char = $stdin.getc
36
+ chr = fifth_char == '~' ? "F2" : ""
37
+ when '3'
38
+ fifth_char = $stdin.getc
39
+ chr = fifth_char == '~' ? "F3" : ""
40
+ when '4'
41
+ fifth_char = $stdin.getc
42
+ chr = fifth_char == '~' ? "F4" : ""
43
+ when '5'
44
+ fifth_char = $stdin.getc
45
+ chr = fifth_char == '~' ? "F5" : ""
46
+ when '7'
47
+ fifth_char = $stdin.getc
48
+ chr = fifth_char == '~' ? "F6" : ""
49
+ when '8'
50
+ fifth_char = $stdin.getc
51
+ chr = fifth_char == '~' ? "F7" : ""
52
+ when '9'
53
+ fifth_char = $stdin.getc
54
+ chr = fifth_char == '~' ? "F8" : ""
55
+ end
28
56
  when '2'
29
57
  fourth_char = $stdin.getc
30
- chr = fourth_char == '~' ? "INS" : ""
58
+ case fourth_char
59
+ when '~' then chr = "INS"
60
+ when '0'
61
+ fifth_char = $stdin.getc
62
+ chr = fifth_char == '~' ? "F9" : ""
63
+ when '1'
64
+ fifth_char = $stdin.getc
65
+ chr = fifth_char == '~' ? "F10" : ""
66
+ when '3'
67
+ fifth_char = $stdin.getc
68
+ chr = fifth_char == '~' ? "F11" : ""
69
+ when '4'
70
+ fifth_char = $stdin.getc
71
+ chr = fifth_char == '~' ? "F12" : ""
72
+ else chr = ""
73
+ end
31
74
  when '3'
32
75
  fourth_char = $stdin.getc
33
76
  chr = fourth_char == '~' ? "DEL" : ""
34
77
  when '5'
35
78
  fourth_char = $stdin.getc
36
- chr = fourth_char == '~' ? "PgUP" : ""
79
+ case fourth_char
80
+ when '~' then chr = "PgUP"
81
+ when '^' then chr = "C-PgUP"
82
+ else chr = ""
83
+ end
37
84
  when '6'
38
85
  fourth_char = $stdin.getc
39
- chr = fourth_char == '~' ? "PgDOWN" : ""
86
+ case fourth_char
87
+ when '~' then chr = "PgDOWN"
88
+ when '^' then chr = "C-PgDOWN"
89
+ else chr = ""
90
+ end
40
91
  when '1', '7'
41
92
  fourth_char = $stdin.getc
42
- chr = fourth_char == '~' ? "HOME" : ""
93
+ case fourth_char
94
+ when '~' then chr = "HOME"
95
+ when '^' then chr = "C-HOME"
96
+ else chr = ""
97
+ end
43
98
  when '4', '8'
44
99
  fourth_char = $stdin.getc
45
- chr = fourth_char == '~' ? "END" : ""
100
+ case fourth_char
101
+ when '~' then chr = "END"
102
+ when '^' then chr = "C-END"
103
+ else chr = ""
104
+ end
46
105
  else
47
106
  chr = ""
48
107
  end
@@ -62,6 +121,7 @@ module Rcurses
62
121
  when "\r", "\n" then chr = "ENTER"
63
122
  when "\t" then chr = "TAB"
64
123
  when "\u007F", "\b" then chr = "BACK"
124
+ when "\u0000" then chr = "C-SPACE"
65
125
  when "\u0001" then chr = "C-A"
66
126
  when "\u0002" then chr = "C-B"
67
127
  when "\u0003" then chr = "C-C"
@@ -85,7 +145,7 @@ module Rcurses
85
145
  when "\u0018" then chr = "C-X"
86
146
  when "\u0019" then chr = "C-Y"
87
147
  when "\u001A" then chr = "C-Z"
88
- when "\u0017" then chr = "WBACK"
148
+ when "\u0017" then chr = "WBACK" # C-W
89
149
  when /[[:print:]]/ then chr = c
90
150
  else chr = ""
91
151
  end
@@ -94,4 +154,3 @@ module Rcurses
94
154
  end
95
155
  end
96
156
  end
97
-
data/lib/rcurses/pane.rb CHANGED
@@ -39,15 +39,37 @@ module Rcurses
39
39
  refresh
40
40
  end
41
41
 
42
- def pageup
43
- @ix = @ix - @h + 1
42
+ def linedown
43
+ @ix += 1
44
+ @ix = @text.split("\n").length if @ix > @text.split("\n").length - 1
45
+ refresh
46
+ end
47
+
48
+ def lineup
49
+ @ix -= 1
44
50
  @ix = 0 if @ix < 0
45
51
  refresh
46
52
  end
47
53
 
48
54
  def pagedown
49
55
  @ix = @ix + @h - 1
50
- @ix = @text.length - 1 if @ix > @text.length - 1
56
+ @ix = @text.split("\n").length - @h if @ix > @text.split("\n").length - @h
57
+ refresh
58
+ end
59
+
60
+ def pageup
61
+ @ix = @ix - @h + 1
62
+ @ix = 0 if @ix < 0
63
+ refresh
64
+ end
65
+
66
+ def bottom
67
+ @ix = @text.split("\n").length - @h
68
+ refresh
69
+ end
70
+
71
+ def top
72
+ @ix = 0
51
73
  refresh
52
74
  end
53
75
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rcurses
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: '2.8'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-26 00:00:00.000000000 Z
11
+ date: 2025-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard
@@ -29,9 +29,8 @@ description: 'Create curses applications for the terminal easier than ever. Crea
29
29
  up text (in panes or anywhere in the terminal) in bold, italic, underline, reverse
30
30
  color, blink and in any 256 terminal colors for foreground and background. Use a
31
31
  simple editor to let users edit text in panes. Left, right or center align text
32
- in panes. Cursor movement around the terminal. New in 2.6: Added methods ''pagedown''
33
- and ''pageup'' to panes enabling text scrolling. 2.6.1: Resetting index ''ix'' to
34
- 0 on pane methods ''puts'' and ''editline''.'
32
+ in panes. Cursor movement around the terminal. New in 2.8: Added lineup and linedown
33
+ methods to pane and more key captures to Rcurses::Input.'
35
34
  email: g@isene.com
36
35
  executables: []
37
36
  extensions: []