rcurses 3.3 → 3.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 +2 -0
- data/lib/rcurses/pane.rb +6 -0
- data/lib/string_extensions.rb +10 -0
- 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: '089c7b974ce66ffc1afdc8c70d6b5d354f11926894329367c4ac304fc56e7af4'
|
4
|
+
data.tar.gz: 23e9d5853f8977ecc914a4cdbfce0a26570d9e3076415709a150c59b5ddc61df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31a9cf284d90a1ead46acfc3f3f77c0777e6e879481e01203e2bb7219579b6d694d50c08d9af7beedcd7a355244bee5975b4f3d9b037827081430abf08363721
|
7
|
+
data.tar.gz: d0f9ed3cdf1a29c10e1a732f61e62c2054ad549edb04398ea5a273c49730c7bdb567e16e59ee67ebdcc9d420499e1823f2c11b087b558bb7e3bfb71b1293b6b0
|
data/README.md
CHANGED
@@ -79,6 +79,7 @@ Method | Description
|
|
79
79
|
new/init | Initializes a Pane with optional arguments `x, y, w, h, fg and bg`
|
80
80
|
move(x,y) | Move the pane by `x`and `y` (`mypane.move(-4,5)` will move the pane left four characters and five characters down)
|
81
81
|
refresh | Refreshes/redraws the Pane with content
|
82
|
+
full_refresh | Refreshes/redraws the Pane with content completely (without diff rendering)
|
82
83
|
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
|
83
84
|
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
|
84
85
|
puts(text) | Short form for setting panel.text, then doing a refresh of that panel
|
@@ -105,6 +106,7 @@ l | Set text to be printed blinking (example: `"TEST".l`)
|
|
105
106
|
r | Set text to be printed in reverse colors (example: `"TEST".r`)
|
106
107
|
c(code) | Use coded format like "TEST".c("204,45,bui") to print "TEST" in bold, underline italic, fg=204 and bg=45 (the format is `.c("fg,bg,biulr"))
|
107
108
|
pure | Strip text of any "dressing" (example: with `text = "TEST".b`, you will have bold text in the variable `text`, then with `text.pure` it will show "uncoded" or pure text)
|
109
|
+
ansi_clean | Strip seemingly uncolored strings of ansi code (those that are enclosed in "\e[0m"
|
108
110
|
shorten(n) | Shorten the pure version of the string to 'n' characters, preserving any ANSI coding
|
109
111
|
inject("chars",pos) | Inject "chars" at position 'pos' in the pure version of the string (if 'pos' is '-1', then append at end). Preserves any ANSI code
|
110
112
|
|
data/lib/rcurses/pane.rb
CHANGED
@@ -106,6 +106,12 @@ module Rcurses
|
|
106
106
|
refresh
|
107
107
|
end
|
108
108
|
|
109
|
+
# full_refresh forces a complete repaint.
|
110
|
+
def full_refresh(cont = @text)
|
111
|
+
@prev_frame = nil
|
112
|
+
refresh(cont)
|
113
|
+
end
|
114
|
+
|
109
115
|
# Diff-based refresh that minimizes flicker.
|
110
116
|
# In this updated version we lazily process only the raw lines required to fill the pane.
|
111
117
|
def refresh(cont = @text)
|
data/lib/string_extensions.rb
CHANGED
@@ -34,6 +34,16 @@ class String
|
|
34
34
|
prop
|
35
35
|
end
|
36
36
|
|
37
|
+
def clean_ansi
|
38
|
+
# Remove surrounding \e[0m if the string is otherwise unstyled
|
39
|
+
stripped = self.gsub(/\A\e\[0m/, '').gsub(/\e\[0m\z/, '')
|
40
|
+
if stripped.pure == stripped
|
41
|
+
stripped
|
42
|
+
else
|
43
|
+
self
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
37
47
|
def pure
|
38
48
|
self.gsub(/\e\[\d+(?:;\d+)*m/, '')
|
39
49
|
end
|
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: '3.
|
4
|
+
version: '3.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: 2025-04-
|
11
|
+
date: 2025-04-05 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 3.
|
33
|
-
|
32
|
+
in panes. Cursor movement around the terminal. New in 3.4: Added ansi_clean and
|
33
|
+
full_refresh methods.'
|
34
34
|
email: g@isene.com
|
35
35
|
executables: []
|
36
36
|
extensions: []
|