rcurses 6.1.1 → 6.1.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 +10 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce484ba636e927e6344a8bb0552c49aec18df5cf3d2ebcb1c80c1d3927da3005
4
- data.tar.gz: 9565880d7a799a27f364e3ec543f69c5061db9e9951684b3747cad5380b5ce85
3
+ metadata.gz: fc7f1658f29a2aa3cb9f753cb645ccb1ae1ca20ee7bec57bee0897c073322c0e
4
+ data.tar.gz: 395e451cfa66f11f2c955c56ab8d6d5408b7af737939c79dd1679f45c55bc231
5
5
  SHA512:
6
- metadata.gz: b6406ba055a63fcd8b187920f4280931b046d651919b08e3792db6a09de8ef5d5383de853847cd44cebf579ccb71c8a7a19b2d147cf825579dca6c96113130b1
7
- data.tar.gz: 5522b3932739d6b726bed53a9b349006f0c7ab44bd79038008ed1f4db2cde530d0fe95e6f38d25bbf627b03a2dea4e8dd10f89991761ea048c65eec79f5dd92c
6
+ metadata.gz: 6c71b9bed8d75a9eaf9f8754d509149582df834c52137df170885e4cb29198bd3db19524ad7b98084163804bd837a21793b74b5e3c90cb419af9ee2de14bd3dc
7
+ data.tar.gz: e0e2c26f75407a1c0de69c87079cf8d010f37723fc49174421eb1e90a5251c7e53f9e83cf0c06f8b856e684866d8d7cf8d3a993facc0ac3c189c66e93648c448
data/lib/rcurses/pane.rb CHANGED
@@ -507,7 +507,10 @@ module Rcurses
507
507
  while input_char != 'ESC'
508
508
  # Move the terminal cursor to the logical text cursor
509
509
  row(@y + @line)
510
- col(@x + @pos)
510
+ # Calculate display width up to cursor position on current line
511
+ current_line_text = @txt[@ix + @line] || ""
512
+ display_pos = @pos > 0 ? Rcurses.display_width(current_line_text.pure[0...@pos]) : 0
513
+ col(@x + display_pos)
511
514
  input_char = getchr(flush: false)
512
515
  case input_char
513
516
  when 'C-L'
@@ -620,7 +623,9 @@ module Rcurses
620
623
  col(@x + prompt_len)
621
624
  cont = cont.slice(0, content_len)
622
625
  print cont.ljust(content_len).c(fmt)
623
- col(@x + prompt_len + @pos)
626
+ # Calculate display width up to cursor position
627
+ display_pos = @pos > 0 ? Rcurses.display_width(cont[0...@pos]) : 0
628
+ col(@x + prompt_len + display_pos)
624
629
  chr = getchr(flush: false)
625
630
  case chr
626
631
  when 'LEFT'
@@ -689,7 +694,9 @@ module Rcurses
689
694
  end
690
695
  end
691
696
  prompt_len = @prompt.pure.length
692
- new_col = @x + prompt_len + (@pos > 0 ? @pos - 1 : 0)
697
+ # Calculate display width for final cursor position
698
+ final_display_pos = @pos > 0 ? Rcurses.display_width(cont[0...(@pos - 1).clamp(0, cont.length)]) : 0
699
+ new_col = @x + prompt_len + final_display_pos
693
700
  col(new_col)
694
701
  Rcurses::Cursor.hide
695
702
  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: 6.1.1
4
+ version: 6.1.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-09-17 00:00:00.000000000 Z
11
+ date: 2025-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard