rcurses 6.3.2 → 7.0.0
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 +9 -10
- data/examples/basic_panes.rb +3 -3
- data/lib/rcurses/emoji.rb +2 -2
- data/lib/rcurses/pane.rb +17 -5
- data/lib/string_extensions.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5fd1bb1d4f965fe2e194fbbf07f967a029374484393685305ebaeb9127b28cc3
|
|
4
|
+
data.tar.gz: 63ceffeb1d7c2ef3ed6d45d5e614349ef6ffe00e5c7f55d32b41f3c2dad7be33
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 30a678a1cdb2e963ffba154bdf8c557da06aecc22b591f4303e7bc80767eb2ca0ca0ff80a4bfa0069a1dbbb04ce695698af66dfb4806309977ad48a69187fafe
|
|
7
|
+
data.tar.gz: 4f16961b164ffc644d8f3cfc3a05896dbcd44fc593ef4678a6e82a3560e052ba179bfff3fa5f4c7a916f8e42358dfec00a001173a389e3fe46ecc5f541a0c66c
|
data/README.md
CHANGED
|
@@ -179,13 +179,13 @@ Method | Description
|
|
|
179
179
|
fg(fg) | Set text to be printed with the foreground color `fg` (example: `"TEST".fg(84)`)
|
|
180
180
|
bg(bg) | Set text to be printed with the background color `bg` (example: `"TEST".bg("dd32a9")`)
|
|
181
181
|
fb(fg, bg) | Set text to be printed with the foreground color `fg` and background color `bg` (example: `"TEST".fb(84,196)`)
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
bd | Set text to be printed in bold (example: `"TEST".bd`)
|
|
183
|
+
it | Set text to be printed in italic (example: `"TEST".it`)
|
|
184
|
+
ul | Set text to be printed underlined (example: `"TEST".ul`)
|
|
185
185
|
l | Set text to be printed blinking (example: `"TEST".l`)
|
|
186
|
-
|
|
186
|
+
rv | Set text to be printed in reverse colors (example: `"TEST".rv`)
|
|
187
187
|
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")`)
|
|
188
|
-
pure | Strip text of any "dressing" (example: with `text = "TEST".
|
|
188
|
+
pure | Strip text of any "dressing" (example: with `text = "TEST".bd`, you will have bold text in the variable `text`, then with `text.pure` it will show "uncoded" or pure text)
|
|
189
189
|
clean_ansi | Strip seemingly uncolored strings of ansi code (those that are enclosed in "\e[0m"
|
|
190
190
|
shorten(n) | Shorten the pure version of the string to 'n' characters, preserving any ANSI coding
|
|
191
191
|
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
|
|
@@ -416,10 +416,9 @@ end
|
|
|
416
416
|
**Problem:** `wait_readable` method not found.
|
|
417
417
|
**Solution:** Always include `require 'io/wait'` for stdin flush.
|
|
418
418
|
|
|
419
|
-
### 5.
|
|
420
|
-
**
|
|
421
|
-
**
|
|
422
|
-
**Workaround:** Use `String.new(encoding: 'ASCII-8BIT')` instead of `''.b` when you need binary strings in code that coexists with rcurses.
|
|
419
|
+
### 5. String formatting methods renamed in 7.0.0
|
|
420
|
+
**Change:** In version 7.0.0, the short method names were renamed to avoid conflicts with Ruby built-ins: `.b` became `.bd` (bold), `.i` became `.it` (italic), `.u` became `.ul` (underline), `.r` became `.rv` (reverse). The old `.b` method conflicted with Ruby's built-in `String#b` which returns a binary-encoded copy of the string.
|
|
421
|
+
**Migration:** Replace `.b` with `.bd`, `.i` with `.it`, `.u` with `.ul`, `.r` with `.rv` in your code.
|
|
423
422
|
|
|
424
423
|
### 6. Border Changes Not Visible
|
|
425
424
|
**Problem:** Changing pane border property doesn't show visual changes.
|
|
@@ -450,7 +449,7 @@ require 'rcurses'
|
|
|
450
449
|
@max_h, @max_w = IO.console.winsize
|
|
451
450
|
mypane = Rcurses::Pane.new(@max_w/2, 30, 30, 10, 19, 229)
|
|
452
451
|
mypane.border = true
|
|
453
|
-
mypane.text = "Hello".
|
|
452
|
+
mypane.text = "Hello".it + " World!".bd.it + "\n \n" + "rcurses".rv + " " + "is cool".c("16,212")
|
|
454
453
|
mypane.refresh
|
|
455
454
|
mypane.edit
|
|
456
455
|
```
|
data/examples/basic_panes.rb
CHANGED
|
@@ -14,10 +14,10 @@ pane_right = Rcurses::Pane.new(@max_w/2 + 1, 2, @max_w/2, @max_h - 2,
|
|
|
14
14
|
pane_left.border = true # Adding a border to the left pane
|
|
15
15
|
|
|
16
16
|
# Add content to the panes
|
|
17
|
-
pane_top.text = Time.now.to_s[0..15].
|
|
17
|
+
pane_top.text = Time.now.to_s[0..15].bd + " Welcome to the rcurses example program"
|
|
18
18
|
pane_left.text = `ls --color`
|
|
19
19
|
pane_right.text = "Output of free:\n\n" + `free`
|
|
20
|
-
pane_bottom.prompt = "Enter any text and press ENTER: ".
|
|
20
|
+
pane_bottom.prompt = "Enter any text and press ENTER: ".bd # The prompt text before the user starts writing content
|
|
21
21
|
|
|
22
22
|
pane_top.refresh # This is the order of drawing/refreshing the panes
|
|
23
23
|
pane_left.refresh # ...then the left pane
|
|
@@ -27,7 +27,7 @@ pane_bottom.editline # Do not use a refresh before editline
|
|
|
27
27
|
# Then create a "pop-up" pane in the middle of the screen
|
|
28
28
|
pane_mid = Rcurses::Pane.new(@max_w/2 - 10, @max_h/2 - 5, 20, 10, 18, 254)
|
|
29
29
|
pane_mid.border = true
|
|
30
|
-
pane_mid.text = "You wrote:" + "\n" + pane_bottom.text.
|
|
30
|
+
pane_mid.text = "You wrote:" + "\n" + pane_bottom.text.it
|
|
31
31
|
pane_mid.align = "c"
|
|
32
32
|
pane_mid.refresh
|
|
33
33
|
|
data/lib/rcurses/emoji.rb
CHANGED
|
@@ -197,13 +197,13 @@ module Rcurses
|
|
|
197
197
|
tab_rows << []
|
|
198
198
|
row_w = 0
|
|
199
199
|
end
|
|
200
|
-
tab_rows.last << (i == cat_idx ? tab.
|
|
200
|
+
tab_rows.last << (i == cat_idx ? tab.bd.rv : tab)
|
|
201
201
|
row_w += tw
|
|
202
202
|
end
|
|
203
203
|
tab_rows.each { |tr| lines << tr.join("") }
|
|
204
204
|
header_lines = tab_rows.size
|
|
205
205
|
else
|
|
206
|
-
lines << " Search: #{search}".
|
|
206
|
+
lines << " Search: #{search}".bd
|
|
207
207
|
header_lines = 1
|
|
208
208
|
end
|
|
209
209
|
lines << ""
|
data/lib/rcurses/pane.rb
CHANGED
|
@@ -477,10 +477,10 @@ module Rcurses
|
|
|
477
477
|
end
|
|
478
478
|
|
|
479
479
|
def parse(cont)
|
|
480
|
-
cont.gsub!(/\*(.+?)\*/, '\1'.
|
|
481
|
-
cont.gsub!(/\/(.+?)\//, '\1'.
|
|
482
|
-
cont.gsub!(/_(.+?)_/, '\1'.
|
|
483
|
-
cont.gsub!(/#(.+?)#/, '\1'.
|
|
480
|
+
cont.gsub!(/\*(.+?)\*/, '\1'.bd)
|
|
481
|
+
cont.gsub!(/\/(.+?)\//, '\1'.it)
|
|
482
|
+
cont.gsub!(/_(.+?)_/, '\1'.ul)
|
|
483
|
+
cont.gsub!(/#(.+?)#/, '\1'.rv)
|
|
484
484
|
cont.gsub!(/<([^|]+)\|([^>]+)>/) do
|
|
485
485
|
text = $2; codes = $1
|
|
486
486
|
text.c(codes)
|
|
@@ -575,10 +575,16 @@ module Rcurses
|
|
|
575
575
|
right
|
|
576
576
|
end
|
|
577
577
|
|
|
578
|
-
# Handle any buffered input
|
|
578
|
+
# Handle any buffered input (multi-line paste)
|
|
579
579
|
while IO.select([$stdin], nil, nil, 0)
|
|
580
580
|
input_char = $stdin.read_nonblock(1) rescue nil
|
|
581
581
|
break unless input_char
|
|
582
|
+
# ESC byte starts an escape sequence (arrow key, etc.)
|
|
583
|
+
# Push it back for getchr to parse properly on next iteration
|
|
584
|
+
if input_char == "\e"
|
|
585
|
+
$stdin.ungetbyte(0x1b)
|
|
586
|
+
break
|
|
587
|
+
end
|
|
582
588
|
posx = calculate_posx
|
|
583
589
|
content.insert(posx, input_char)
|
|
584
590
|
right
|
|
@@ -728,6 +734,12 @@ module Rcurses
|
|
|
728
734
|
while IO.select([$stdin], nil, nil, 0)
|
|
729
735
|
chr = $stdin.read_nonblock(1) rescue nil
|
|
730
736
|
break unless chr
|
|
737
|
+
# ESC byte starts an escape sequence (arrow key, etc.)
|
|
738
|
+
# Push it back for getchr to parse properly on next iteration
|
|
739
|
+
if chr == "\e"
|
|
740
|
+
$stdin.ungetbyte(0x1b)
|
|
741
|
+
break
|
|
742
|
+
end
|
|
731
743
|
# Normalize \r\n to a single newline: skip \n after \r
|
|
732
744
|
if chr == "\n" && last_was_cr
|
|
733
745
|
last_was_cr = false
|
data/lib/string_extensions.rb
CHANGED
|
@@ -45,11 +45,11 @@ class String
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
# bold, italic, underline, blink, reverse
|
|
48
|
-
def
|
|
49
|
-
def
|
|
50
|
-
def
|
|
48
|
+
def bd; color(self, "\e[1m", "\e[22m"); end
|
|
49
|
+
def it; color(self, "\e[3m", "\e[23m"); end
|
|
50
|
+
def ul; color(self, "\e[4m", "\e[24m"); end
|
|
51
51
|
def l; color(self, "\e[5m", "\e[25m"); end
|
|
52
|
-
def
|
|
52
|
+
def rv; color(self, "\e[7m", "\e[27m"); end
|
|
53
53
|
|
|
54
54
|
# Internal helper - wraps +text+ in start/end sequences,
|
|
55
55
|
# and re-applies start on every newline.
|
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: 7.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Geir Isene
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-04-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: clipboard
|