rcurses 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -8
- data/lib/rcurses.rb +0 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0411fe63ee57de3eec47170eb8367708f18ea848fd88ecbe14cca62ae11e40e
|
4
|
+
data.tar.gz: 9b500a1a7df79b63cb7ef0d8a8775ff9ea32dce7354842c6ccbed0623c9566ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a56c0c656ca11e0e6b5fc4823c6ad427a28bf75b1fc51df12d29ea0cd60b214d2581b8df3354a4d034f0af56b2c0a3ed6c7ba00a914e9aab3bef4645912a4fbf
|
7
|
+
data.tar.gz: 62467880b4c9b8e56ed68070e6d5bc8bd8e0cc3d2050a51f225c22ad6a64aacb3a2e5d64835b377d7269ee428ae612e17e358e1789a343d0d5be80f482e07c24
|
data/README.md
CHANGED
@@ -12,9 +12,7 @@ Having struggled with the venerable curses library and the ruby interface to it
|
|
12
12
|
Simple. One file. No external requirements.
|
13
13
|
|
14
14
|
# Installation
|
15
|
-
|
16
|
-
|
17
|
-
Or simply run `gem install rcurses`.
|
15
|
+
Simply run `gem install rcurses`.
|
18
16
|
|
19
17
|
To use this library do:
|
20
18
|
```
|
@@ -33,18 +31,18 @@ require 'rcurses'
|
|
33
31
|
* The class `Pane` to create and manilpulate panes/boxes
|
34
32
|
* Extensions to the class String to print text in various degrees of fancy and also strip any fanciness
|
35
33
|
* A module `Cursor` to give you cursor movements around the terminal
|
36
|
-
* A
|
34
|
+
* A module `Rinput` providing the function `getchr` to capture a single character input from the user (much better than any Ruby built-ins)
|
37
35
|
|
38
36
|
# class Pane
|
39
37
|
To create a pane do something like this:
|
40
38
|
```
|
41
|
-
mypane = Pane.new(80, 30, 30, 10, 19, 229)
|
39
|
+
mypane = Rcurses::Pane.new(80, 30, 30, 10, 19, 229)
|
42
40
|
```
|
43
41
|
This will create a pane/box starting at terminal column/x 80 and row/y 30 with the width of 30 characters and a hight of 10 characters and with the foreground color 19 and background color 229 (from the 256 choices available)
|
44
42
|
|
45
43
|
The format for creating a pane is:
|
46
44
|
```
|
47
|
-
Pane.new(startx, starty, width, height, foregroundcolor, backgroundcolor)
|
45
|
+
Rcurses::Pane.new(startx, starty, width, height, foregroundcolor, backgroundcolor)
|
48
46
|
```
|
49
47
|
You can drop the last two 256-color codes to create a pane with the defaults for your terminal. Also, you can add anything as `startx`, `starty`, `width` or `height` as those values will be run through a Ruby eval and stored in readable variables `x`, `y`, `w` and `h` respectively. So, a hight value of "@maxrow/2" is valid to create a pane with the height of half the terminal height (the integer corresponding to half the terminal height will then be accessible as the variable `h`). Use the variables @maxrow for terminal height and @maxcol for terminal width.
|
50
48
|
|
@@ -123,10 +121,14 @@ scroll_up | Scroll display up one line
|
|
123
121
|
scroll_down | Scroll display down one line
|
124
122
|
clear_screen_down | Clear screen down from current row
|
125
123
|
|
126
|
-
#
|
124
|
+
# Rinput::getchr
|
127
125
|
rcurses provides a vital extension to Ruby in reading characters entered by the user. This is especially needed for curses applications where readline inputs are required.
|
128
126
|
|
129
|
-
|
127
|
+
To include this into your curses program, first:
|
128
|
+
```
|
129
|
+
include Rinput
|
130
|
+
```
|
131
|
+
Then simply use `chr = getchr` in a program to read any character input by the user. The returning code (the content of `chr` in this example could be any of the following:
|
130
132
|
|
131
133
|
Key pressed | string returned
|
132
134
|
----------------|----------------------------------------------------------
|
data/lib/rcurses.rb
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rcurses
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geir Isene
|
@@ -14,8 +14,8 @@ description: 'Create panes (with the colors and(or border), manipulate the panes
|
|
14
14
|
add content. Dress up text (in panes or anywhere in the terminal) in bold, italic,
|
15
15
|
underline, reverse color, blink and in any 256 terminal colors for foreground and
|
16
16
|
background. Use a simple editor to let users edit text in panes. Left, right or
|
17
|
-
center align text in panes. Cursor movement around the terminal. New in 0.
|
18
|
-
|
17
|
+
center align text in panes. Cursor movement around the terminal. New in 0.4: Code-reorganization
|
18
|
+
and bugfix.'
|
19
19
|
email: g@isene.com
|
20
20
|
executables: []
|
21
21
|
extensions:
|