rcurses 4.7 → 4.8.1
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 +1 -1
- data/lib/rcurses/pane.rb +8 -7
- data/lib/rcurses.rb +1 -1
- data/lib/string_extensions.rb +9 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f123fdc7761b5229b89890546447495b8096d3f67a64d304631926fc295eb43e
|
4
|
+
data.tar.gz: 9a2385d358bf235272a30689b8dc9dd443f956865c723911c356278aeeade0bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7624e84a82c461a0ec03dfe1f972e4b55c928993ec1d6d1e729ae00e99f739b009e1fb5cdbb4ff37c1d05c1e7476ee7fe966a98b36c7169f8db5ab8cb0d4792f
|
7
|
+
data.tar.gz: ef00d32f5f4909589519816b2adb859f4a5b4063c796191d5cad582f6fcb0a6c57a5a4f0b4efaa1f9dd2571b36490453c33ed8456f16381b7eadf55249cf0aaf
|
data/README.md
CHANGED
@@ -118,7 +118,7 @@ l | Set text to be printed blinking (example: `"TEST".l`)
|
|
118
118
|
r | Set text to be printed in reverse colors (example: `"TEST".r`)
|
119
119
|
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")`)
|
120
120
|
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)
|
121
|
-
|
121
|
+
clean_ansi | Strip seemingly uncolored strings of ansi code (those that are enclosed in "\e[0m"
|
122
122
|
shorten(n) | Shorten the pure version of the string to 'n' characters, preserving any ANSI coding
|
123
123
|
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
|
124
124
|
|
data/lib/rcurses/pane.rb
CHANGED
@@ -176,8 +176,9 @@ module Rcurses
|
|
176
176
|
|
177
177
|
o_row, o_col = pos
|
178
178
|
|
179
|
-
# Hide cursor
|
180
|
-
|
179
|
+
# Hide cursor, disable auto-wrap, reset all SGR and scroll margins
|
180
|
+
# (so stray underline, scroll regions, etc. can’t leak out)
|
181
|
+
STDOUT.print "\e[?25l\e[?7l\e[0m\e[r"
|
181
182
|
|
182
183
|
fmt = [@fg.to_s, @bg.to_s].join(',')
|
183
184
|
|
@@ -220,11 +221,11 @@ module Rcurses
|
|
220
221
|
hl = pl / 2
|
221
222
|
case @align
|
222
223
|
when "l"
|
223
|
-
line_str = @txt[l].c(fmt) + " ".c(fmt) * pl
|
224
|
+
line_str = @txt[l].pure.c(fmt) + " ".c(fmt) * pl
|
224
225
|
when "r"
|
225
|
-
line_str = " ".c(fmt) * pl + @txt[l].c(fmt)
|
226
|
+
line_str = " ".c(fmt) * pl + @txt[l].pure.c(fmt)
|
226
227
|
when "c"
|
227
|
-
line_str = " ".c(fmt) * hl + @txt[l].c(fmt) + " ".c(fmt) * (pl - hl)
|
228
|
+
line_str = " ".c(fmt) * hl + @txt[l].pure.c(fmt) + " ".c(fmt) * (pl - hl)
|
228
229
|
end
|
229
230
|
else
|
230
231
|
line_str = " ".c(fmt) * @w
|
@@ -242,8 +243,8 @@ module Rcurses
|
|
242
243
|
end
|
243
244
|
end
|
244
245
|
|
245
|
-
#
|
246
|
-
diff_buf << "\e[#{o_row};#{o_col}H\e[?7h"
|
246
|
+
# restore wrap, then also reset SGR and scroll-region one more time
|
247
|
+
diff_buf << "\e[#{o_row};#{o_col}H\e[?7h\e[0m\e[r"
|
247
248
|
print diff_buf
|
248
249
|
@prev_frame = new_frame
|
249
250
|
|
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: 4.
|
8
|
+
# Version: 4.8.1: Bugfix: Fixed ANSI nesting bug
|
9
9
|
|
10
10
|
require 'io/console' # Basic gem for rcurses
|
11
11
|
require 'io/wait' # stdin handling
|
data/lib/string_extensions.rb
CHANGED
@@ -98,7 +98,15 @@ class String
|
|
98
98
|
|
99
99
|
# Remove stray leading/trailing reset if the string has no other styling
|
100
100
|
def clean_ansi
|
101
|
-
|
101
|
+
# If we have opening ANSI codes without proper closing, just use pure
|
102
|
+
# to avoid unbalanced sequences that can corrupt terminal display
|
103
|
+
temp = gsub(/\A(?:\e\[0m)+/, '').gsub(/\e\[0m\z/, '')
|
104
|
+
# Check if we have unbalanced ANSI sequences (opening codes without closing)
|
105
|
+
if temp =~ /\e\[[\d;]+m/ && temp !~ /\e\[0m\z/
|
106
|
+
pure
|
107
|
+
else
|
108
|
+
temp
|
109
|
+
end
|
102
110
|
end
|
103
111
|
|
104
112
|
# Truncate the *visible* length to n, but preserve embedded ANSI
|
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:
|
4
|
+
version: 4.8.1
|
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-
|
11
|
+
date: 2025-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clipboard
|
@@ -30,8 +30,7 @@ description: 'Create curses applications for the terminal easier than ever. Crea
|
|
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
32
|
in panes. Cursor movement around the terminal. New in 3.8: Fixed border fragments
|
33
|
-
upon utf-8 characters. 4.
|
34
|
-
Added attr ''index'' to pane.'
|
33
|
+
upon utf-8 characters. 4.8.1: Bugfix: Fixed ANSI nesting bug.'
|
35
34
|
email: g@isene.com
|
36
35
|
executables: []
|
37
36
|
extensions: []
|