rb-readline 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 62e9f284762457dd7a3623ef60c95024ae96d513
4
- data.tar.gz: 190b43ef9f6d15da4921f48c923776c305c3bfef
3
+ metadata.gz: c3159d70047f7143ac3691670bf88e0d49962c03
4
+ data.tar.gz: bc91ac5ba0ac0c0a09da8f6e60d42be1044df171
5
5
  SHA512:
6
- metadata.gz: 587ae50714415826ec7b09435b6e98ef6b8b82888144e6d8a5b2e99d68fc3dbbff527af117323829aeceb0a8b06fd3cbf525288734557c205f15b23efacdcad7
7
- data.tar.gz: 3ea8429737a5b37c40900ae813632a8bb7646a7b0c164ac3c301dfbd30111aac357360d91c99a7bc4f520cbaa97f74fdcecf9fffd9afbfed524bc4ed950511dc
6
+ metadata.gz: f81bd2d07418af204da27451fa28ad7ea58ea91f3c5e222fa8dff96afa6957233d72aa8512b1754e5aeefc5c8ca6020968e7b315f85bbefdc080335d42cd6828
7
+ data.tar.gz: c1a2292dd3db790d667a60b5b5af9d4ffb39bc8b8b86d9f839c572097cee256d3112c55c74fe9629d01f0ed6d40ef276230b4e6af31aaf58c4c5defe09614b9f
@@ -1555,7 +1555,7 @@ module RbReadline
1555
1555
  end
1556
1556
 
1557
1557
  if @hConsoleHandle
1558
- csbi = 0.chr * 24
1558
+ csbi = Fiddle::Pointer.malloc(24)
1559
1559
  @GetConsoleScreenBufferInfo.Call(@hConsoleHandle,csbi)
1560
1560
  x,y = csbi[4,4].unpack('SS')
1561
1561
  x = dpos
@@ -1812,7 +1812,7 @@ module RbReadline
1812
1812
 
1813
1813
  def get_term_capabilities(buffer)
1814
1814
  hash = {}
1815
- `infocmp -C`.split(':').select{|x| x =~ /(.*)=(.*)/ and hash[$1]=$2.gsub('\\E',"\e").gsub(/\^(.)/){($1[0].ord ^ ((?a..?z).include?($1[0]) ? 0x60 : 0x40)).chr}}
1815
+ `infocmp -C`.split(':').select{|x| x =~ /(.*)=(.*)/ and hash[$1]=$2.gsub("\\r", "\r").gsub('\\E',"\e").gsub(/\^(.)/){($1[0].ord ^ ((?a..?z).include?($1[0]) ? 0x60 : 0x40)).chr}}
1816
1816
  @_rl_term_at7 = hash["@7"]
1817
1817
  @_rl_term_DC = hash["DC"]
1818
1818
  @_rl_term_IC = hash["IC"]
@@ -1859,7 +1859,7 @@ module RbReadline
1859
1859
  def _rl_get_screen_size(tty, ignore_env)
1860
1860
 
1861
1861
  if @hConsoleHandle
1862
- csbi = 0.chr * 24
1862
+ csbi = Fiddle::Pointer.malloc(24)
1863
1863
  @GetConsoleScreenBufferInfo.Call(@hConsoleHandle,csbi)
1864
1864
  wc,wr = csbi[0,4].unpack('SS')
1865
1865
  # wr,wc, = `mode con`.scan(/\d+\n/).map{|x| x.to_i}
@@ -4436,7 +4436,7 @@ module RbReadline
4436
4436
 
4437
4437
  def call(*args)
4438
4438
  args.each_with_index do |x, i|
4439
- args[i], = [x == 0 ? nil : x].pack("p").unpack("l!*") if @proto[i] == "S"
4439
+ args[i], = [x == 0 ? nil : x].pack("p").unpack("l!*") if @proto[i] == "S" && !x.is_a?(Fiddle::Pointer)
4440
4440
  args[i], = [x].pack("I").unpack("i") if @proto[i] == "I"
4441
4441
  end
4442
4442
  @func.call(*args).to_i || 0
@@ -4658,10 +4658,10 @@ module RbReadline
4658
4658
  # number of character spaces to clear,
4659
4659
  def space_to_eol(count)
4660
4660
  if @hConsoleHandle
4661
- csbi = 0.chr * 24
4661
+ csbi = Fiddle::Pointer.malloc(24)
4662
4662
  @GetConsoleScreenBufferInfo.Call(@hConsoleHandle,csbi)
4663
4663
  cursor_pos = csbi[4,4].unpack('L').first
4664
- written = 0.chr * 4
4664
+ written = Fiddle::Pointer.malloc(4)
4665
4665
  @FillConsoleOutputCharacter.Call(@hConsoleHandle,0x20,count,cursor_pos,written)
4666
4666
  else
4667
4667
  @rl_outstream.write(' ' * count)
@@ -6132,7 +6132,7 @@ module RbReadline
6132
6132
 
6133
6133
  def alloc_history_entry(string, ts)
6134
6134
  temp = Struct.new(:line,:data,:timestamp).new
6135
- temp.line = string ? string.delete(0.chr) : string
6135
+ temp.line = string ? string.encode('UTF-8', invalid: :replace, undef: :replace, replace: '').delete(0.chr) : string
6136
6136
  temp.data = nil
6137
6137
  temp.timestamp = ts
6138
6138
 
@@ -7016,7 +7016,7 @@ module RbReadline
7016
7016
 
7017
7017
  setting << " -ixoff"
7018
7018
 
7019
- rl_bind_key(@_rl_tty_chars.t_start, :rl_restart_output)
7019
+ rl_bind_key(@_rl_tty_chars.t_start, :rl_restart_output) unless @_rl_tty_chars.t_start.nil?
7020
7020
  @_rl_eof_char = @_rl_tty_chars.t_eof
7021
7021
 
7022
7022
  #setting << " -isig"
@@ -1,3 +1,3 @@
1
1
  module RbReadline
2
- RB_READLINE_VERSION = "0.5.4"
2
+ RB_READLINE_VERSION = "0.5.5"
3
3
  end
@@ -316,6 +316,16 @@ module Readline
316
316
  RbReadline.rl_point
317
317
  end
318
318
 
319
+ # Temporarily disable warnings and call a block
320
+ #
321
+ def self.silence_warnings(&block)
322
+ warn_level = $VERBOSE
323
+ $VERBOSE = nil
324
+ result = block.call
325
+ $VERBOSE = warn_level
326
+ result
327
+ end
328
+
319
329
  # The History class encapsulates a history of all commands entered by
320
330
  # users at the prompt, providing an interface for inspection and retrieval
321
331
  # of all commands.
@@ -455,7 +465,7 @@ module Readline
455
465
 
456
466
  end
457
467
 
458
- HISTORY = History unless const_defined? :HISTORY
468
+ silence_warnings { HISTORY = History }
459
469
 
460
470
  # The Fcomp class provided to encapsulate typical filename completion
461
471
  # procedure. You will not typically use this directly, but will instead
@@ -483,7 +493,7 @@ module Readline
483
493
  end
484
494
  end
485
495
 
486
- FILENAME_COMPLETION_PROC = Fcomp unless const_defined? :FILENAME_COMPLETION_PROC
496
+ silence_warnings { FILENAME_COMPLETION_PROC = Fcomp }
487
497
 
488
498
  # The Ucomp class provided to encapsulate typical filename completion
489
499
  # procedure. You will not typically use this directly, but will instead
@@ -514,13 +524,13 @@ module Readline
514
524
  end
515
525
  end
516
526
 
517
- USERNAME_COMPLETION_PROC = Ucomp unless const_defined? :USERNAME_COMPLETION_PROC
527
+ silence_warnings { USERNAME_COMPLETION_PROC = Ucomp }
518
528
 
519
529
  RbReadline.rl_readline_name = "Ruby"
520
530
 
521
531
  RbReadline.using_history()
522
532
 
523
- VERSION = RbReadline.rl_library_version unless const_defined? :VERSION
533
+ silence_warnings { VERSION = RbReadline.rl_library_version }
524
534
 
525
535
  module_function :readline
526
536
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb-readline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Park Heesob
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-02-10 00:00:00.000000000 Z
14
+ date: 2017-07-29 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake