rcurses 2.4.6 → 2.4.7
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 +4 -4
- data/README.md +2 -1
- data/lib/rcurses/input.rb +18 -9
- data/lib/rcurses/pane.rb +6 -0
- data/lib/rcurses.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3614072a43262fae0361e5fbca943f1e4da81a13a79b4bc2ea9ca7342d935c9
|
4
|
+
data.tar.gz: 4195f8f7ab5b5183f671487eb9df121a01db6991c4eafb5b5f81c19c0e190b12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1f74c9ae9a72accf1b7cff35f772ca53b61bbc39f56dee8f190ead264fe6dc735e771bcac563832eae17b80452ea5b2098c63be6fbd20e386f18c3727112365
|
7
|
+
data.tar.gz: 06d521b146ed4962f5bd94d4c359bf8811ff1454ec6ede89e42ec2206fc32090186bf8bc8fc9df1acccdc0642f2cec2a5974656817969c76429d2b59f443b013
|
data/README.md
CHANGED
@@ -85,6 +85,7 @@ move(x,y) | Move the pane by `x`and `y` (`mypane.move(-4,5)` will move the
|
|
85
85
|
refresh | Refreshes/redraws the Pane with content
|
86
86
|
edit | An editor for the Pane. When this is invoked, all existing font dressing is stripped and the user gets to edit the raw text. The user can add font effects similar to Markdown; Use an asterisk before and after text to be drawn in bold, text between forward-slashes become italic, and underline before and after text means the text will be underlined, a hash-sign before and after text makes the text reverse colored. You can also combine a whole set of dressings in this format: `<23,245,biurl|Hello World!>` - this will make "Hello World!" print in the color 23 with the background color 245 (regardless of the Pane's fg/bg setting) in bold, italic, underlined, reversed colored and blinking. Hitting `ESC` while in edit mode will disregard the edits, while `Ctrl-S` will save the edits
|
87
87
|
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
|
88
|
+
ask(prompt,text) | Short form of setting panel.prompt, then panel.text and then doing a panel.editline
|
88
89
|
|
89
90
|
# class String extensions
|
90
91
|
Method extensions provided for the class String:
|
@@ -204,7 +205,7 @@ while $stdin.ready?
|
|
204
205
|
chr += $stdin.getc
|
205
206
|
end
|
206
207
|
```
|
207
|
-
You can also pass
|
208
|
+
You can also pass a timeout to `getchr` with `getchr(time)` to wait for `time` number of seconds and returning `nil` if the user does not press a key.
|
208
209
|
|
209
210
|
|
210
211
|
# Example
|
data/lib/rcurses/input.rb
CHANGED
@@ -1,14 +1,21 @@
|
|
1
1
|
module Rcurses
|
2
2
|
module Input
|
3
|
-
def getchr(
|
4
|
-
#
|
5
|
-
|
3
|
+
def getchr(t = nil)
|
4
|
+
# Wait for input up to t seconds; if none, return nil (or a timeout indicator)
|
5
|
+
if t && !IO.select([$stdin], nil, nil, t)
|
6
|
+
return nil
|
7
|
+
end
|
8
|
+
|
9
|
+
c = $stdin.getch
|
6
10
|
case c
|
7
|
-
when "\e"
|
8
|
-
|
11
|
+
when "\e"
|
12
|
+
# For escape sequences, use a very short timeout to check for extra bytes
|
13
|
+
unless IO.select([$stdin], nil, nil, 0.001)
|
14
|
+
return "ESC"
|
15
|
+
end
|
9
16
|
second_char = $stdin.getc
|
10
17
|
case second_char
|
11
|
-
when '['
|
18
|
+
when '['
|
12
19
|
third_char = $stdin.getc
|
13
20
|
case third_char
|
14
21
|
when 'A' then chr = "UP"
|
@@ -34,16 +41,18 @@ module Rcurses
|
|
34
41
|
when '4', '8'
|
35
42
|
fourth_char = $stdin.getc
|
36
43
|
chr = fourth_char == '~' ? "END" : ""
|
37
|
-
else
|
44
|
+
else
|
45
|
+
chr = ""
|
38
46
|
end
|
39
|
-
when 'O'
|
47
|
+
when 'O'
|
40
48
|
third_char = $stdin.getc
|
41
49
|
case third_char
|
42
50
|
when 'a' then chr = "C-UP"
|
43
51
|
when 'b' then chr = "C-DOWN"
|
44
52
|
when 'c' then chr = "C-RIGHT"
|
45
53
|
when 'd' then chr = "C-LEFT"
|
46
|
-
else
|
54
|
+
else
|
55
|
+
chr = ""
|
47
56
|
end
|
48
57
|
else
|
49
58
|
chr = ""
|
data/lib/rcurses/pane.rb
CHANGED
data/lib/rcurses.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Web_site: http://isene.com/
|
6
6
|
# Github: https://github.com/isene/rcurses
|
7
7
|
# License: Public domain
|
8
|
-
# Version: 2.4.
|
8
|
+
# Version: 2.4.7: Fixed getchr timeout, added panel function 'ask'
|
9
9
|
|
10
10
|
require 'io/console' # Basic gem for rcurses
|
11
11
|
require 'io/wait' # stdin handling
|
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.4.
|
4
|
+
version: 2.4.7
|
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-
|
11
|
+
date: 2025-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clipboard
|
@@ -29,8 +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.4.
|
33
|
-
|
32
|
+
in panes. Cursor movement around the terminal. New in 2.4.7: Fixed getchr timeout,
|
33
|
+
added panel function ''ask''.'
|
34
34
|
email: g@isene.com
|
35
35
|
executables: []
|
36
36
|
extensions: []
|