rcurses 5.0.0 → 5.1.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -2
  3. data/lib/rcurses/input.rb +13 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff839fa4bfa8b545649ea90177a931c9fbb445a42b44627579772dc853461106
4
- data.tar.gz: b4182b2b2e8829959de75e85c551440cf43e534eae34dc719947c7f0315b793b
3
+ metadata.gz: 1346854c517fefd3324ccc5613ed153a37ef05affd38f0acdaef9c53f26d8f69
4
+ data.tar.gz: 045e189341a04b64bdeecf2086ea65c176d7e0712f7e39184f053e1ed64efb36
5
5
  SHA512:
6
- metadata.gz: 72f4617b7fdb711a536721626605e996b068dcfcebb02ba8f4244fc333d177fe8130fa37a55d6887d343bd6b8948b1b385f26c4e1de6bd7edc76e910f209e6e9
7
- data.tar.gz: f5921342d7c0699c230e0ee7cfd3f3448e436e816bf9b7a5d8cad85efeaa81d0609af818a5cc8cd916ae5899e97416d155feb4eeaf24f567e0fa86b83a704769
6
+ metadata.gz: 5e95c6ff7ae4e65910e87eec6811276a857ec3e8fcf4a2a459b300ea13a1a47ed37b4e44abdf2e6292059fe110e987ef647c2069f52f0b86d43d2e1994bceb95
7
+ data.tar.gz: c4924e43e90ffef0cf575caa05092012cfa597affc8982529e4254ed8013bf18b43eefa087e190be977f514074eb357f082b82687c8641fba0d6761852d5cff9
data/README.md CHANGED
@@ -10,8 +10,15 @@ Here's a somewhat simple example of a TUI program using rcurses: The [T-REX](htt
10
10
 
11
11
  And here's a much more involved example: The [RTFM](https://github.com/isene/RTFM) terminal file manager.
12
12
 
13
- # NOTE: Version 4.5 gives full RGB support in addition to 256-colors
14
- Just write a color as a string - e.g. `"d533e0"` for a hexadecimal RGB color (or use the terminal 256 colors by supplying an integer in the range 0-255)
13
+ # NOTE: Version 5.0.0 brings major improvements!
14
+ - **Memory leak fixes** - Better memory management and history limits
15
+ - **Terminal state protection** - Proper terminal restoration on crashes
16
+ - **Enhanced Unicode support** - Better handling of CJK characters and emojis
17
+ - **Error handling improvements** - More robust operation in edge cases
18
+ - **Performance optimizations** - Maintains the speed of version 4.8.3
19
+ - **Full backward compatibility** - All existing applications work unchanged
20
+
21
+ Version 4.5 gave full RGB support in addition to 256-colors. Just write a color as a string - e.g. `"d533e0"` for a hexadecimal RGB color (or use the terminal 256 colors by supplying an integer in the range 0-255)
15
22
 
16
23
  # Why?
17
24
  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.
@@ -92,6 +99,7 @@ full_refresh | Refreshes/redraws the Pane with content completely (without dif
92
99
  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
93
100
  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
94
101
  clear | Clears the pane
102
+ cleanup | Cleans up pane memory (history, caches) - useful for memory management
95
103
  say(text) | Short form for setting panel.text, then doing a refresh of that panel
96
104
  ask(prompt,text) | Short form of setting panel.prompt, then panel.text, doing a panel.editline and then returning panel.text
97
105
  pagedown | Scroll down one page height in the text (minus one line), but not longer than the length of the text
data/lib/rcurses/input.rb CHANGED
@@ -8,6 +8,7 @@ module Rcurses
8
8
  rescue Timeout::Error
9
9
  return nil
10
10
  end
11
+
11
12
 
12
13
  # 2) If it's ESC, grab any quick trailing bytes
13
14
  seq = c
@@ -19,6 +20,8 @@ module Rcurses
19
20
  end
20
21
  end
21
22
  end
23
+
24
+
22
25
 
23
26
  # 3) Single ESC alone
24
27
  return "ESC" if seq == "\e"
@@ -38,6 +41,11 @@ module Rcurses
38
41
  if m = seq.match(/\A\e\[\d+;2([ABCD])\z/)
39
42
  return { 'A' => "S-UP", 'B' => "S-DOWN", 'C' => "S-RIGHT", 'D' => "S-LEFT" }[m[1]]
40
43
  end
44
+
45
+ # 6b) CSI style ctrl-arrows (e.g. ESC [1;5A )
46
+ if m = seq.match(/\A\e\[\d+;5([ABCD])\z/)
47
+ return { 'A' => "C-UP", 'B' => "C-DOWN", 'C' => "C-RIGHT", 'D' => "C-LEFT" }[m[1]]
48
+ end
41
49
 
42
50
  # 7) Plain arrows
43
51
  if m = seq.match(/\A\e\[([ABCD])\z/)
@@ -66,13 +74,17 @@ module Rcurses
66
74
  end
67
75
  end
68
76
 
69
- # 9) SS3 function keys F1-F4
77
+ # 9) SS3 function keys F1-F4 and Ctrl+arrows
70
78
  if seq.start_with?("\eO") && seq.length == 3
71
79
  return case seq[2]
72
80
  when 'P' then "F1"
73
81
  when 'Q' then "F2"
74
82
  when 'R' then "F3"
75
83
  when 'S' then "F4"
84
+ when 'a' then "C-UP" # Some terminals send ESC O a for Ctrl+Up
85
+ when 'b' then "C-DOWN" # Some terminals send ESC O b for Ctrl+Down
86
+ when 'c' then "C-RIGHT" # Some terminals send ESC O c for Ctrl+Right
87
+ when 'd' then "C-LEFT" # Some terminals send ESC O d for Ctrl+Left
76
88
  else ""
77
89
  end
78
90
  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: 5.0.0
4
+ version: 5.1.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: 2025-07-03 00:00:00.000000000 Z
11
+ date: 2025-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard