rcurses 3.7.2 → 3.7.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f5f1abba12690ed9ad662a78930994e8a4a8667abafe4508d467f059007951a
4
- data.tar.gz: fa3a289bbb5f24f77a3417505a9c860a375efc3498860946b938d392ec36c20d
3
+ metadata.gz: d300db2c5840595d0716539687b0c5d6de38d0d60543373f49edf3bd19b953dd
4
+ data.tar.gz: 5eed2e21c1912e456640cf54516ffcadece0d7bac70862fd63965299a97c60f1
5
5
  SHA512:
6
- metadata.gz: 21fc4e420009b25f19e635ad48cec4124e396ff8a56ae4fc900cf9a1e171f7af9f9126d0a50439632cf0ea4afe6ea5e3a4c531cb66275c8eafef7fd541da69e1
7
- data.tar.gz: 3c0bb2893b2b561d842665bbac5543cd1e337f8c9ea6ebdd1d3e1d1d942ed62fc18c7c92a1234c319d1c5732b96a814b28c176c594114889d442057b2ccad84a
6
+ metadata.gz: 29eac670b3bd278d0b4f3a76ca892278510a94243318ca7f5aa29b05a95b336ec5b4911763c198b73b1028114525d438d7f9da9f323315ef337a8258ba206ebc
7
+ data.tar.gz: 32dd6bcad30a491872f7e6880e811a6326b5df317bff395e6e6d431d976ebeb252521eb093c5dc7959d6d5303e7c056f39e4f335198888a8cf2533a345a27e7f
data/lib/rcurses/input.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Rcurses
2
2
  module Input
3
- def getchr(t = nil)
3
+ def getchr(t = nil, flush: true)
4
4
  begin
5
5
  # 1) Read a byte (with optional timeout)
6
6
  begin
@@ -111,11 +111,13 @@ module Rcurses
111
111
  else ""
112
112
  end
113
113
  ensure
114
- while IO.select([$stdin], nil, nil, 0)
115
- begin
116
- $stdin.read_nonblock(4096)
117
- rescue IO::WaitReadable, EOFError
118
- break
114
+ if flush
115
+ while IO.select([$stdin], nil, nil, 0)
116
+ begin
117
+ $stdin.read_nonblock(4096)
118
+ rescue IO::WaitReadable, EOFError
119
+ break
120
+ end
119
121
  end
120
122
  end
121
123
  end
data/lib/rcurses/pane.rb CHANGED
@@ -342,7 +342,8 @@ module Rcurses
342
342
 
343
343
  def edit
344
344
  begin
345
- STDIN.raw!
345
+ STDIN.cooked! rescue nil
346
+ STDIN.echo = true rescue nil
346
347
  Rcurses::Cursor.show
347
348
  content = @text.pure.gsub("\n", "¬\n")
348
349
  @ix = 0
@@ -354,7 +355,7 @@ module Rcurses
354
355
  while input_char != 'ESC'
355
356
  row(@y + @line)
356
357
  col(@x + @pos)
357
- input_char = getchr
358
+ input_char = getchr(flush: false)
358
359
  case input_char
359
360
  when 'C-L'
360
361
  @align = 'l'
@@ -432,14 +433,19 @@ module Rcurses
432
433
  @txt = refresh(content)
433
434
  end
434
435
  ensure
435
- STDIN.cooked!
436
+ STDIN.raw! rescue nil
437
+ STDIN.echo = false rescue nil
438
+ while IO.select([$stdin], nil, nil, 0)
439
+ $stdin.read_nonblock(4096) rescue break
440
+ end
436
441
  end
437
442
  Rcurses::Cursor.hide
438
443
  end
439
444
 
440
445
  def editline
441
446
  begin
442
- STDIN.raw!
447
+ STDIN.cooked! rescue nil
448
+ STDIN.echo = true rescue nil
443
449
  Rcurses::Cursor.show
444
450
  @x = [[@x, 1].max, @max_w - @w + 1].min
445
451
  @y = [[@y, 1].max, @max_h - @h + 1].min
@@ -461,7 +467,7 @@ module Rcurses
461
467
  cont = cont.slice(0, content_len)
462
468
  print cont.ljust(content_len).c(fmt)
463
469
  col(@x + prompt_len + @pos)
464
- chr = getchr
470
+ chr = getchr(flush: false)
465
471
  case chr
466
472
  when 'LEFT'
467
473
  @pos -= 1 if @pos > 0
@@ -522,7 +528,11 @@ module Rcurses
522
528
  end
523
529
  end
524
530
  ensure
525
- STDIN.cooked!
531
+ STDIN.raw! rescue nil
532
+ STDIN.echo = false rescue nil
533
+ while IO.select([$stdin], nil, nil, 0)
534
+ $stdin.read_nonblock(4096) rescue break
535
+ end
526
536
  end
527
537
  Rcurses::Cursor.hide
528
538
  end
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.7.2: Better fix for straggling residue key codes
8
+ # Version: 3.7.3: Fixed pasting bug in edit(line)
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.7.2
4
+ version: 3.7.3
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-19 00:00:00.000000000 Z
11
+ date: 2025-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard
@@ -29,8 +29,8 @@ description: 'Create curses applications for the terminal easier than ever. Crea
29
29
  up text (in panes or anywhere in the terminal) in bold, italic, underline, reverse
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
- in panes. Cursor movement around the terminal. New in 3.7.2: Better fix for straggling
33
- residue key codes.'
32
+ in panes. Cursor movement around the terminal. New in 3.7.3: Fixed pasting bug in
33
+ edit(line).'
34
34
  email: g@isene.com
35
35
  executables: []
36
36
  extensions: []