rcurses 6.0.1 → 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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rcurses/pane.rb +36 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53036cc4649face7e14b08f311890f1ccd0e09acd6f65f15a797578b4184d7ac
4
- data.tar.gz: eef69f7e651ef3d62bd7f68d42a92d166267ef67fcef5a6e20753ecd1a95acb9
3
+ metadata.gz: d2c123f55e8e4f06030596e1d16aca219f068152bf5d723db7a7aac5d98f1b6d
4
+ data.tar.gz: 710f29dc036627434e650a7380c8ab8845c4fe075f185a70dfcc4274e84d3f36
5
5
  SHA512:
6
- metadata.gz: a28c4b75f14b35c4fc92d2c26d7fc214db22944c59d185d44c89f32ecc8078593d5a84d9082b96d968e1b4156341fd8790ce95f2c3b478ecd8b8318054047763
7
- data.tar.gz: 31df11786aa48deda46a57917f2ce586f93ff6db27e7ee118fd52fbe42c5c57c69f5c8cb69852163fd0991fcd060c0728dc7e810980db8d51272e2d650aa5383
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 = ("┌" + "─" * @w + "┐").c(fmt)
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" + "│".c(fmt)
144
- STDOUT.print "\e[#{row};#{right_col}H" + "│".c(fmt)
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 = ("└" + "─" * @w + "┘").c(fmt)
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)
@@ -361,15 +375,29 @@ module Rcurses
361
375
  end
362
376
 
363
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
+
364
392
  # top
365
- print "\e[#{@y - 1};#{@x - 1}H" + ("┌" + "─" * @w + "┐").c(fmt)
393
+ print "\e[#{@y - 1};#{@x - 1}H" + (tl + h * @w + tr).c(fmt)
366
394
  # sides
367
395
  (0...@h).each do |i|
368
- print "\e[#{@y + i};#{@x - 1}H" + "│".c(fmt)
369
- print "\e[#{@y + i};#{@x + @w}H" + "│".c(fmt)
396
+ print "\e[#{@y + i};#{@x - 1}H" + v.c(fmt)
397
+ print "\e[#{@y + i};#{@x + @w}H" + v.c(fmt)
370
398
  end
371
399
  # bottom
372
- print "\e[#{@y + @h};#{@x - 1}H" + ("└" + "─" * @w + "┘").c(fmt)
400
+ print "\e[#{@y + @h};#{@x - 1}H" + (bl + h * @w + br).c(fmt)
373
401
  end
374
402
 
375
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.1
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-15 00:00:00.000000000 Z
11
+ date: 2025-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard