rcurses 2.2 → 2.4
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 +6 -3
- data/lib/rcurses/cursor.rb +2 -2
- data/lib/rcurses/pane.rb +4 -0
- data/lib/rcurses.rb +1 -1
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6b5f0fbbc0c9c981c1e4d23197008f4a5ea00cff36492938328fe30c52804af
|
4
|
+
data.tar.gz: d4ee9ba0743c045168d0528534f5cc3f5571b3e968948d8553afdb768aebb1c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53b164b30ccb430b541a6880c51d298c8ddaa38b7d5b97b1714c53ca0c5e100caa1883c1caec210816f03704ff3d1b59715c317bd015c480c83e49227a91e7ed
|
7
|
+
data.tar.gz: 89ecd3c6021dcfd70bf390723de8a7d75210a85b5e73077dfb7f0167f3faad9c68e422b25ef4ed564fa4fd3341d32ac6c90e70132910e025e278f82ec3b892ec
|
data/README.md
CHANGED
@@ -4,12 +4,13 @@
|
|
4
4
|
|
5
5
|
<img src="img/rcurses-logo.png" width="150" height="150">
|
6
6
|
|
7
|
+
Create curses applications for the terminal easier than ever.
|
7
8
|
|
8
9
|
# Why?
|
9
10
|
Having struggled with the venerable curses library and the ruby interface to it for many years, I finally got around to write an alternative - in pure Ruby.
|
10
11
|
|
11
12
|
# Design principles
|
12
|
-
Simple
|
13
|
+
Simple and with minimum of external dependencies.
|
13
14
|
|
14
15
|
# Installation
|
15
16
|
Simply run `gem install rcurses`.
|
@@ -104,7 +105,7 @@ pure | Strip text of any "dressing" (example: with `text = "TEST".b`,
|
|
104
105
|
PS: Blink does not work in conjunction with setting a background color in urxvt. It does work in gnome-terminal. But the overall performance in urxvt as orders of magnitude better than gnome-terminal.
|
105
106
|
|
106
107
|
# module Cursor
|
107
|
-
Create a new cursor object with `mycursor = Cursor`. Then you can apply the following methods to `mycursor`:
|
108
|
+
To use this module, first do `include Rcurses::Cursor`. Create a new cursor object with `mycursor = Rcurses::Cursor`. Then you can apply the following methods to `mycursor`:
|
108
109
|
|
109
110
|
Method | Description
|
110
111
|
------------------|---------------------------------------------------------------
|
@@ -128,10 +129,12 @@ clear_line_after | Erase from the current position (inclusive) to the end of th
|
|
128
129
|
scroll_up | Scroll display up one line
|
129
130
|
scroll_down | Scroll display down one line
|
130
131
|
clear_screen_down | Clear screen down from current row
|
132
|
+
hide | Hide the cursor
|
133
|
+
show | Show cursor
|
131
134
|
|
132
135
|
# The function getchr
|
133
136
|
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.
|
134
|
-
The function getchr is automatically included in your arsenal when you first do `include
|
137
|
+
The function getchr is automatically included in your arsenal when you first do `include Rcurses::Input`.
|
135
138
|
|
136
139
|
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:
|
137
140
|
|
data/lib/rcurses/cursor.rb
CHANGED
@@ -41,7 +41,7 @@ module Rcurses
|
|
41
41
|
def clear_screen_down; print(CSI + 'J'); end # Clear screen down from current row
|
42
42
|
def scroll_up; print(ESC + 'M'); end # Scroll display up one line
|
43
43
|
def scroll_down; print(ESC + 'D'); end # Scroll display down one line
|
44
|
-
def
|
45
|
-
def
|
44
|
+
def hide; print(CSI + '?25l'); end # Scroll display down one line
|
45
|
+
def show; print(CSI + '?25h'); end # Scroll display down one line
|
46
46
|
end
|
47
47
|
end
|
data/lib/rcurses/pane.rb
CHANGED
@@ -287,6 +287,7 @@ module Rcurses
|
|
287
287
|
begin
|
288
288
|
# Switch to raw mode without echoing input
|
289
289
|
STDIN.raw!
|
290
|
+
Rcurses::Cursor.show
|
290
291
|
# Prepare content for editing, replacing newlines with a placeholder
|
291
292
|
content = @text.pure.gsub("\n", "¬\n")
|
292
293
|
# Initialize cursor position and indices
|
@@ -384,12 +385,14 @@ module Rcurses
|
|
384
385
|
# Restore terminal mode
|
385
386
|
STDIN.cooked!
|
386
387
|
end
|
388
|
+
Rcurses::Cursor.hide
|
387
389
|
end
|
388
390
|
|
389
391
|
def editline
|
390
392
|
begin
|
391
393
|
# Switch to raw mode without echo
|
392
394
|
STDIN.raw!
|
395
|
+
Rcurses::Cursor.show
|
393
396
|
|
394
397
|
# Initialize position and dimensions
|
395
398
|
@x = @startx.call
|
@@ -468,6 +471,7 @@ module Rcurses
|
|
468
471
|
# Restore terminal mode
|
469
472
|
STDIN.cooked!
|
470
473
|
end
|
474
|
+
Rcurses::Cursor.hide
|
471
475
|
end
|
472
476
|
|
473
477
|
private
|
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.
|
8
|
+
# Version: 2.4: Show cursor on edit. Changed hide_cursor and show_cursor to hide and show.
|
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
|
+
version: '2.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geir Isene
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clipboard
|
@@ -24,12 +24,13 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
|
-
description: 'Create
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
description: 'Create curses applications for the terminal easier than ever. Create
|
28
|
+
panes (with the colors and(or border), manipulate the panes and add content. Dress
|
29
|
+
up text (in panes or anywhere in the terminal) in bold, italic, underline, reverse
|
30
|
+
color, blink and in any 256 terminal colors for foreground and background. Use a
|
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: Show cursor on edit.
|
33
|
+
Changed hide_cursor and show_cursor to hide and show.'
|
33
34
|
email: g@isene.com
|
34
35
|
executables: []
|
35
36
|
extensions: []
|