fancy_irb 1.0.2 → 1.1.0

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: 6bd897b79b18d01f373c1559c2c7a12ca14f2164
4
- data.tar.gz: 7bc42840677843d4e61769c7ddec3b14c6d3cfc3
3
+ metadata.gz: 2a97871a844939aa181c7e03bbf1054c74d1e97e
4
+ data.tar.gz: 04ef4e6f02a68d4b4971c4264ff6521383d827d6
5
5
  SHA512:
6
- metadata.gz: 7444265dffbf53f820b5caad81c56514e646fab9c8d4b0a6e0e29c6d2a0aa2b85a07850ef6722b9827bc9a92e88e2b43c605c04d6f1e640d9b5909b034aaffc5
7
- data.tar.gz: 8d6e1c0c873fa84072672be1a7eede62da62742482427673f588f657395d84d8a2c95dca0fc92096e0b272b07f7363f62b001bef2edc4c08a30a9b2534953ecf
6
+ metadata.gz: d769722f7cfba9e17932458884fb41dfb46a498dee86dd79081ace353c59b0c4cbf0726cabe00dc6507da14eb4cee4aa6b35a5aaf1919653aa909cb09b5a9974
7
+ data.tar.gz: 0f51d36feac350499e31835c60772f48304d4f60a1b4c6cef7ca345cecf0441df6c1434a44bba565750fe74e993a9a2192e3a15c4f1bcdd6e46065c761e8bd7a
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.1.0
4
+ * Rename `east_asian_width` option to `unicode_display_width` and activate by default
5
+ * Relax paint dependency
6
+
3
7
  ## 1.0.2
4
8
  * Bump unicode-display_width to 1.0
5
9
 
@@ -12,15 +16,12 @@
12
16
  * Recognize multi-line regexes
13
17
  * Improve size detector (-> less wrongly placed rockets)
14
18
 
15
-
16
19
  ## 0.8.2
17
20
  * Support objects that don't support #inspect
18
21
 
19
-
20
22
  ## 0.8.1
21
23
  * Use io/console correctly, fixes bug on mingw
22
24
 
23
-
24
25
  ## 0.8.0
25
26
  * Internals partly refactored
26
27
  * Bump paint and unicode-display_width dependencies
@@ -32,28 +33,22 @@
32
33
  * Not patching Kernel anymore
33
34
  * Only path String if east_asian_width option is used
34
35
 
35
-
36
36
  ## 0.7.3
37
37
  * Don't colorize stdout by default
38
38
  * Deactivate rocket for common system commands
39
39
 
40
-
41
40
  ## 0.7.2
42
41
  * Fix a small bug that happens if there was no last line
43
42
 
44
-
45
43
  ## 0.7.1
46
44
  * Deactivate buggy input coloring :/
47
45
 
48
-
49
46
  ## 0.7.0
50
47
  * Use paint gem for terminal colors
51
48
  * Fix some rocket issues (when using with colored content)
52
49
 
53
-
54
50
  ## 0.6.5
55
51
  * Windows support
56
52
 
57
-
58
53
  ## < 0.6.5
59
54
  See https://github.com/janlelis/fancy_irb/commits/0.6.4
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2012, 2015-2016 Jan Lelis
1
+ Copyright (c) 2010-2012, 2015-2017 Jan Lelis
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -12,11 +12,12 @@
12
12
  You can pass an options hash. These are the default values:
13
13
 
14
14
  DEFAULT_OPTIONS = {
15
- :rocket_mode => true, # activate or deactivate #=> rocket
16
- :rocket_prompt => '#=> ', # prompt to use for the rocket
17
- :result_prompt => '=> ', # prompt to use for normal output
18
- :east_asian_width => false, # set to true if you have double-width characters (slower)
19
- :colorize => { # colors hash. Set to nil to deactivate colors
15
+ :rocket_mode => true, # activate or deactivate #=> rocket
16
+ :rocket_prompt => '#=> ', # prompt to use for the rocket
17
+ :result_prompt => '=> ', # prompt to use for normal output
18
+ :unicode_display_width => true, # set to false if you don't want to check for proper
19
+ # string width for better performance
20
+ :colorize => { # colors hash. Set to nil to deactivate colors
20
21
  :rocket_prompt => [:blue],
21
22
  :result_prompt => [:blue],
22
23
  :input_prompt => nil,
@@ -39,11 +40,12 @@ documentation](https://github.com/janlelis/paint).
39
40
  ### Windows Support
40
41
  You will need [ansicon](https://github.com/adoxa/ansicon) or [ConEmu](https://code.google.com/p/conemu-maximus5/).
41
42
 
42
- ### Wrong display widths?
43
- When using double-width unicode chars, you should set `:east_asian_width` to
44
- `true`. It is not activated by default, because of its performance impact.
43
+ ### Need More Performance?
44
+ The gem checks for the Unicode display width of characters, which requires a
45
+ lookup of every character. You can deactivate this check by setting
46
+ `:unicode_display_width` to `false`.
45
47
 
46
- ### Known bugs
48
+ ### Known Bugs
47
49
  Not all stdin methods are patched properly to work with the rocket: The gems
48
50
  focuses on the often used ones
49
51
 
@@ -51,5 +53,5 @@ focuses on the often used ones
51
53
  ## J-_-L
52
54
  Inspired by the irb_rocket gem by genki.
53
55
 
54
- Copyright (c) 2010-2012, 2015 Jan Lelis <http://janlelis.com> released under
56
+ Copyright (c) 2010-2012, 2015-2017 Jan Lelis <http://janlelis.com> released under
55
57
  the MIT license.
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  s.required_ruby_version = '>= 1.9.3'
14
14
  s.license = 'MIT'
15
15
  s.requirements = ['Windows: ansicon <https://github.com/adoxa/ansicon>']
16
- s.add_dependency 'paint', '>= 0.9', '< 2.0'
17
- s.add_dependency 'unicode-display_width', "~> 1.0"
16
+ s.add_dependency 'paint', '>= 0.9', '< 3.0'
17
+ s.add_dependency 'unicode-display_width', "~> 1.1"
18
18
  s.add_development_dependency 'rspec', "~> 3.2"
19
19
  s.add_development_dependency 'rake', "~> 10.4"
20
20
  s.files = [
@@ -37,4 +37,3 @@ Gem::Specification.new do |s|
37
37
  "spec/fixtures.rb",
38
38
  ]
39
39
  end
40
-
@@ -2,6 +2,7 @@ require_relative 'fancy_irb/version'
2
2
 
3
3
  require 'stringio'
4
4
  require 'paint'
5
+ require 'unicode/display_width'
5
6
 
6
7
  require_relative 'fancy_irb/terminal_info'
7
8
  require_relative 'fancy_irb/size_detector'
@@ -10,11 +11,12 @@ require_relative 'fancy_irb/implementation'
10
11
 
11
12
  module FancyIrb
12
13
  DEFAULT_OPTIONS = {
13
- :rocket_mode => true, # activate or deactivate #=> rocket output
14
- :rocket_prompt => '#=> ', # prompt to use for the rocket
15
- :result_prompt => '=> ', # prompt to use for normal output
16
- :east_asian_width => false, # set to true if you have double-width characters (slower)
17
- :colorize => { # colors hash. Set to nil to deactivate colors
14
+ :rocket_mode => true, # activate or deactivate #=> rocket output
15
+ :rocket_prompt => '#=> ', # prompt to use for the rocket
16
+ :result_prompt => '=> ', # prompt to use for normal output
17
+ :unicode_display_width => true, # set to false if you don't want to check for proper
18
+ # string width for better performance
19
+ :colorize => { # colors hash. Set to nil to deactivate colors
18
20
  :rocket_prompt => [:blue],
19
21
  :result_prompt => [:blue],
20
22
  :input_prompt => nil,
@@ -17,7 +17,6 @@ module FancyIrb
17
17
 
18
18
  # hook into IRB
19
19
  def extend!
20
- require 'unicode/display_width' if @options[:east_asian_width]
21
20
  require_relative 'irb_ext'
22
21
  require_relative 'core_ext'
23
22
  require_relative 'clean_up'
@@ -51,9 +50,10 @@ module FancyIrb
51
50
  }
52
51
  end
53
52
 
54
- def east_asian_width?
55
- @options[:east_asian_width]
53
+ def unicode_display_width?
54
+ @options[:unicode_display_width] || @options[:east_asian_width]
56
55
  end
56
+ alias east_asian_width? unicode_display_width?
57
57
 
58
58
  def reset_line!
59
59
  @tracked_height = 0
@@ -5,7 +5,7 @@ module FancyIrb
5
5
  def width_of(data)
6
6
  return 0 unless data
7
7
  data = Paint.unpaint data.to_s
8
- FancyIrb.east_asian_width? ? data.display_width : data.size
8
+ FancyIrb.unicode_display_width? ? Unicode::DisplayWidth.of(data) : data.length
9
9
  end
10
10
 
11
11
  def height_of(data, width)
@@ -1,3 +1,3 @@
1
1
  module FancyIrb
2
- VERSION = '1.0.2'.freeze
2
+ VERSION = '1.1.0'.freeze
3
3
  end
@@ -5,10 +5,9 @@ describe FancyIrb::SizeDetector do
5
5
  include FancyIrb::SizeDetector
6
6
 
7
7
  before do
8
- FancyIrb.instance_variable_set(:@options, {east_asian_width: false})
8
+ FancyIrb.instance_variable_set(:@options, { unicode_display_width: true })
9
9
  end
10
10
 
11
-
12
11
  describe ".width_of" do
13
12
  it "returns 0 when no data given" do
14
13
  expect( width_of(nil) ).to eq 0
@@ -22,18 +21,17 @@ describe FancyIrb::SizeDetector do
22
21
  expect( width_of("\e[31mstring\e[0m") ).to eq 6
23
22
  end
24
23
 
25
- it "does not respect double-width chars by default" do
26
- expect( width_of('一') ).to eq 1
24
+ it "respects double-width chars by default" do
25
+ expect( width_of('一') ).to eq 2
27
26
  end
28
27
 
29
- context "east_asian_width? true" do
28
+ context "unicode_display_width? false" do
30
29
  before do
31
- require 'unicode/display_width'
32
- FancyIrb.instance_variable_set(:@options, {east_asian_width: true})
30
+ FancyIrb.instance_variable_set(:@options, { unicode_display_width: false })
33
31
  end
34
32
 
35
- it "respects double-width chars" do
36
- expect( width_of('一') ).to eq 2
33
+ it "does not respect double-width chars" do
34
+ expect( width_of('一') ).to eq 1
37
35
  end
38
36
  end
39
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fancy_irb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Lelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-03 00:00:00.000000000 Z
11
+ date: 2017-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paint
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '0.9'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '2.0'
22
+ version: '3.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,21 +29,21 @@ dependencies:
29
29
  version: '0.9'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '2.0'
32
+ version: '3.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: unicode-display_width
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '1.0'
39
+ version: '1.1'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '1.0'
46
+ version: '1.1'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - 'Windows: ansicon <https://github.com/adoxa/ansicon>'
118
118
  rubyforge_project:
119
- rubygems_version: 2.5.1
119
+ rubygems_version: 2.6.8
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: FancyIrb makes IRB friendly.