rcurses 6.0.0 → 6.0.2
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/lib/rcurses/pane.rb +46 -11
- 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: d2c123f55e8e4f06030596e1d16aca219f068152bf5d723db7a7aac5d98f1b6d
|
4
|
+
data.tar.gz: 710f29dc036627434e650a7380c8ab8845c4fe075f185a70dfcc4274e84d3f36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75f5d56983cab919f679e84123bbe3287a05356fd3c3cfc93def62f0273a386638cf8ca692ffc384e1db00377d6aa75f27bbad355547543649dd82284ef6a661
|
7
|
+
data.tar.gz: e3bc08762e5fbed4f53149eab64b2543b0c6d145388b734037b65fa0eafc20887f4f71945725a5b1e5cf68b3a9b0cda3c5b6a4ea8215dbc853e5a10a5caca782
|
data/lib/rcurses/pane.rb
CHANGED
@@ -135,15 +135,29 @@ module Rcurses
|
|
135
135
|
bottom_row = @y + @h
|
136
136
|
|
137
137
|
if @border
|
138
|
+
# Determine border characters based on environment
|
139
|
+
if ENV['RCURSES_BORDERS'] == 'ascii'
|
140
|
+
tl, tr, bl, br, h, v = '+', '+', '+', '+', '-', '|'
|
141
|
+
else
|
142
|
+
# Check if locale supports UTF-8
|
143
|
+
locale = ENV['LANG'] || ENV['LC_ALL'] || ENV['LC_CTYPE'] || ''
|
144
|
+
if locale.downcase.include?('utf-8') || locale.downcase.include?('utf8')
|
145
|
+
tl, tr, bl, br, h, v = '┌', '┐', '└', '┘', '─', '│'
|
146
|
+
else
|
147
|
+
# Fallback to ASCII for non-UTF-8 locales
|
148
|
+
tl, tr, bl, br, h, v = '+', '+', '+', '+', '-', '|'
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
138
152
|
fmt = [@fg.to_s, @bg.to_s].join(',')
|
139
|
-
top = (
|
153
|
+
top = (tl + h * @w + tr).c(fmt)
|
140
154
|
STDOUT.print "\e[#{top_row};#{left_col}H" + top
|
141
155
|
(0...@h).each do |i|
|
142
156
|
row = @y + i
|
143
|
-
STDOUT.print "\e[#{row};#{left_col}H" +
|
144
|
-
STDOUT.print "\e[#{row};#{right_col}H" +
|
157
|
+
STDOUT.print "\e[#{row};#{left_col}H" + v.c(fmt)
|
158
|
+
STDOUT.print "\e[#{row};#{right_col}H" + v.c(fmt)
|
145
159
|
end
|
146
|
-
bottom = (
|
160
|
+
bottom = (bl + h * @w + br).c(fmt)
|
147
161
|
STDOUT.print "\e[#{bottom_row};#{left_col}H" + bottom
|
148
162
|
else
|
149
163
|
STDOUT.print "\e[#{top_row};#{left_col}H" + " " * (@w + 2)
|
@@ -223,10 +237,17 @@ module Rcurses
|
|
223
237
|
|
224
238
|
content_rows = @h
|
225
239
|
# Ensure we have processed enough lines for the current scroll position + visible area.
|
226
|
-
|
227
|
-
|
240
|
+
# Dynamically process more lines as needed when scrolling through large lists
|
241
|
+
required_lines = @ix + content_rows + 100 # Larger buffer for smoother scrolling
|
242
|
+
|
243
|
+
# Safety limit to prevent excessive memory usage (but still very generous)
|
244
|
+
max_allowed = 100000 # Allow up to 100k lines which should handle any reasonable directory
|
228
245
|
|
229
|
-
|
246
|
+
# Process lines on demand as we scroll
|
247
|
+
while @lazy_txt.size < required_lines && @lazy_index < @raw_txt.size
|
248
|
+
# Safety check to prevent runaway memory usage
|
249
|
+
break if @lazy_txt.size > max_allowed
|
250
|
+
|
230
251
|
raw_line = @raw_txt[@lazy_index]
|
231
252
|
# If the raw line is short, no wrapping is needed.
|
232
253
|
if raw_line.respond_to?(:pure) && Rcurses.display_width(raw_line.pure) < @w
|
@@ -354,15 +375,29 @@ module Rcurses
|
|
354
375
|
end
|
355
376
|
|
356
377
|
if @border
|
378
|
+
# Determine border characters based on environment
|
379
|
+
if ENV['RCURSES_BORDERS'] == 'ascii'
|
380
|
+
tl, tr, bl, br, h, v = '+', '+', '+', '+', '-', '|'
|
381
|
+
else
|
382
|
+
# Check if locale supports UTF-8
|
383
|
+
locale = ENV['LANG'] || ENV['LC_ALL'] || ENV['LC_CTYPE'] || ''
|
384
|
+
if locale.downcase.include?('utf-8') || locale.downcase.include?('utf8')
|
385
|
+
tl, tr, bl, br, h, v = '┌', '┐', '└', '┘', '─', '│'
|
386
|
+
else
|
387
|
+
# Fallback to ASCII for non-UTF-8 locales
|
388
|
+
tl, tr, bl, br, h, v = '+', '+', '+', '+', '-', '|'
|
389
|
+
end
|
390
|
+
end
|
391
|
+
|
357
392
|
# top
|
358
|
-
print "\e[#{@y - 1};#{@x - 1}H" + (
|
393
|
+
print "\e[#{@y - 1};#{@x - 1}H" + (tl + h * @w + tr).c(fmt)
|
359
394
|
# sides
|
360
395
|
(0...@h).each do |i|
|
361
|
-
print "\e[#{@y + i};#{@x - 1}H" +
|
362
|
-
print "\e[#{@y + i};#{@x + @w}H" +
|
396
|
+
print "\e[#{@y + i};#{@x - 1}H" + v.c(fmt)
|
397
|
+
print "\e[#{@y + i};#{@x + @w}H" + v.c(fmt)
|
363
398
|
end
|
364
399
|
# bottom
|
365
|
-
print "\e[#{@y + @h};#{@x - 1}H" + (
|
400
|
+
print "\e[#{@y + @h};#{@x - 1}H" + (bl + h * @w + br).c(fmt)
|
366
401
|
end
|
367
402
|
|
368
403
|
new_frame.join("\n")
|
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: 6.0.
|
4
|
+
version: 6.0.2
|
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-08-
|
11
|
+
date: 2025-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clipboard
|