rcurses 3.9 → 4.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 (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -0
  3. data/lib/rcurses/pane.rb +29 -0
  4. data/lib/rcurses.rb +1 -1
  5. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b86d406d96a0e08b0cf5b1d5e6ddc0a0e3a8908293405e59dcedf230276bde95
4
- data.tar.gz: 91a3ac14bc426f1d864baee262b3b070aa1b5c7fdd94397f82b10ddd405b91b2
3
+ metadata.gz: 64fede93e0d646b947c3cf6c3217a1aa7bf62f923b724a4dd55b02e3981b8593
4
+ data.tar.gz: 3dca4a698dbbc31356e50e322d3e52ba2c0d6a574b7b824e6d6fe7d5d5b49dd2
5
5
  SHA512:
6
- metadata.gz: cfef56d215b5906f531c23b81756cba928ee25249893ad3464c9c64c42b121c8e5a1de3cf5110511dbb4b1b538ef09e1e1cdcf629724109c9c081c9371109135
7
- data.tar.gz: 6c422acb468b451f959399161c8483d9812d99dc88c0afd1aa76335635a31ab2d81e247c98fca69f0242b7fd92e0e35e3f39338a09d2a1dd52e55374d8f51537
6
+ metadata.gz: e866db8fa1db394653b90a88c73632d024b7b565db7f984360004b6d4bb4b83c56650e2784669bf827f32585dbbbb9918f98016d5a6612ee39ff352e194b7f84
7
+ data.tar.gz: 67ceadf4ccb04fb5708e0faa33253099156cddedd9fe906d5d24a11d9ccfeac836a945ff7990f19df380f64061a986836a6432206e5f7a8cd09cb6f9e112e81b
data/README.md CHANGED
@@ -243,6 +243,17 @@ mypane.edit
243
243
 
244
244
  And - try running the example file `rcurses_example.rb`.
245
245
 
246
+ # Clean exit for your application
247
+ To restore the terminal fully after you exit your application, add this:
248
+ ```
249
+ at_exit do # Always restore terminal state on quit (or fatal)
250
+ $stdin.cooked!
251
+ $stdin.echo = true
252
+ Rcurses.clear_screen
253
+ Cursor.show
254
+ end
255
+ ```
256
+
246
257
  # Not yet implemented
247
258
  Let me know what other features you like to see.
248
259
 
data/lib/rcurses/pane.rb CHANGED
@@ -128,6 +128,35 @@ module Rcurses
128
128
  refresh(cont)
129
129
  end
130
130
 
131
+ # Refresh only the border
132
+ def border_refresh
133
+ left_col = @x - 1
134
+ right_col = @x + @w
135
+ top_row = @y - 1
136
+ bottom_row = @y + @h
137
+
138
+ if @border
139
+ fmt = [@fg.to_s, @bg.to_s].join(',')
140
+ top = ("┌" + "─" * @w + "┐").c(fmt)
141
+ STDOUT.print "\e[#{top_row};#{left_col}H" + top
142
+ (0...@h).each do |i|
143
+ row = @y + i
144
+ STDOUT.print "\e[#{row};#{left_col}H" + "│".c(fmt)
145
+ STDOUT.print "\e[#{row};#{right_col}H" + "│".c(fmt)
146
+ end
147
+ bottom = ("└" + "─" * @w + "┘").c(fmt)
148
+ STDOUT.print "\e[#{bottom_row};#{left_col}H" + bottom
149
+ else
150
+ STDOUT.print "\e[#{top_row};#{left_col}H" + " " * (@w + 2)
151
+ (0...@h).each do |i|
152
+ row = @y + i
153
+ STDOUT.print "\e[#{row};#{left_col}H" + " "
154
+ STDOUT.print "\e[#{row};#{right_col}H" + " "
155
+ end
156
+ STDOUT.print "\e[#{bottom_row};#{left_col}H" + " " * (@w + 2)
157
+ end
158
+ end
159
+
131
160
  # Diff-based refresh that minimizes flicker.
132
161
  # In this updated version we lazily process only the raw lines required to fill the pane.
133
162
  def refresh(cont = @text)
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: 3.9: Fixed bug on pane parameters passed as nil. Better examples.
8
+ # Version: 4.0: Added border_refresh to refresh only the border of a pane
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: '3.9'
4
+ version: '4.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-04-30 00:00:00.000000000 Z
11
+ date: 2025-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard
@@ -30,7 +30,8 @@ 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. 3.9: Fixed bug on pane parameters passed as nil. Better examples.'
33
+ upon utf-8 characters. 4.0: Added border_refresh to refresh only the border of a
34
+ pane.'
34
35
  email: g@isene.com
35
36
  executables: []
36
37
  extensions: []