Skip to content

Commit

Permalink
Drop showing indent level number in DEFAULT prompt and INF_RUBY prompt (
Browse files Browse the repository at this point in the history
#679)

* Drop showing indent level number in DEFAULT prompt and INF_RUBY prompt

* Update prompt part of test_rendering's expected result
  • Loading branch information
tompng authored Aug 12, 2023
1 parent c5f5abd commit 3847532
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 58 deletions.
18 changes: 9 additions & 9 deletions lib/irb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@
# For instance, the default prompt mode is defined as follows:
#
# IRB.conf[:PROMPT_MODE][:DEFAULT] = {
# :PROMPT_I => "%N(%m):%03n:%i> ",
# :PROMPT_N => "%N(%m):%03n:%i> ",
# :PROMPT_S => "%N(%m):%03n:%i%l ",
# :PROMPT_C => "%N(%m):%03n:%i* ",
# :PROMPT_I => "%N(%m):%03n> ",
# :PROMPT_N => "%N(%m):%03n> ",
# :PROMPT_S => "%N(%m):%03n%l ",
# :PROMPT_C => "%N(%m):%03n* ",
# :RETURN => "%s\n" # used to printf
# }
#
Expand All @@ -211,10 +211,10 @@
# # :RETURN: |
# # %s
# # :DEFAULT:
# # :PROMPT_I: ! '%N(%m):%03n:%i> '
# # :PROMPT_N: ! '%N(%m):%03n:%i> '
# # :PROMPT_S: ! '%N(%m):%03n:%i%l '
# # :PROMPT_C: ! '%N(%m):%03n:%i* '
# # :PROMPT_I: ! '%N(%m):%03n> '
# # :PROMPT_N: ! '%N(%m):%03n> '
# # :PROMPT_S: ! '%N(%m):%03n%l '
# # :PROMPT_C: ! '%N(%m):%03n* '
# # :RETURN: |
# # => %s
# # :CLASSIC:
Expand All @@ -232,7 +232,7 @@
# # :RETURN: |
# # => %s
# # :INF_RUBY:
# # :PROMPT_I: ! '%N(%m):%03n:%i> '
# # :PROMPT_I: ! '%N(%m):%03n> '
# # :PROMPT_N:
# # :PROMPT_S:
# # :PROMPT_C:
Expand Down
10 changes: 5 additions & 5 deletions lib/irb/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ def IRB.init_config(ap_path)
:RETURN => "%s\n"
},
:DEFAULT => {
:PROMPT_I => "%N(%m):%03n:%i> ",
:PROMPT_N => "%N(%m):%03n:%i> ",
:PROMPT_S => "%N(%m):%03n:%i%l ",
:PROMPT_C => "%N(%m):%03n:%i* ",
:PROMPT_I => "%N(%m):%03n> ",
:PROMPT_N => "%N(%m):%03n> ",
:PROMPT_S => "%N(%m):%03n%l ",
:PROMPT_C => "%N(%m):%03n* ",
:RETURN => "=> %s\n"
},
:CLASSIC => {
Expand All @@ -85,7 +85,7 @@ def IRB.init_config(ap_path)
:RETURN => "=> %s\n"
},
:INF_RUBY => {
:PROMPT_I => "%N(%m):%03n:%i> ",
:PROMPT_I => "%N(%m):%03n> ",
:PROMPT_N => nil,
:PROMPT_S => nil,
:PROMPT_C => nil,
Expand Down
88 changes: 44 additions & 44 deletions test/irb/yamatanooroti/test_rendering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def test_launch
close
assert_screen(<<~EOC)
start IRB
irb(main):001:0> 'Hello, World!'
irb(main):001> 'Hello, World!'
=> "Hello, World!"
irb(main):002:0>
irb(main):002>
EOC
end

Expand All @@ -68,21 +68,21 @@ def b; true; end
close
assert_screen(<<~EOC)
start IRB
irb(main):001:1* class A
irb(main):002:1* def inspect; '#<A>'; end
irb(main):003:1* def a; self; end
irb(main):004:1* def b; true; end
irb(main):005:0> end
irb(main):001* class A
irb(main):002* def inspect; '#<A>'; end
irb(main):003* def a; self; end
irb(main):004* def b; true; end
irb(main):005> end
=> :b
irb(main):006:0>
irb(main):007:0> a = A.new
irb(main):006>
irb(main):007> a = A.new
=> #<A>
irb(main):008:0>
irb(main):009:0> a
irb(main):010:0> .a
irb(main):011:0> .b
irb(main):008>
irb(main):009> a
irb(main):010> .a
irb(main):011> .b
=> true
irb(main):012:0>
irb(main):012>
EOC
end

Expand Down Expand Up @@ -121,39 +121,39 @@ class A def b; self; end; def c; true; end; end;
close
assert_screen(<<~EOC)
start IRB
irb(main):001:1* class A
irb(main):002:1* def inspect; '#<A>'; end
irb(main):003:1* def b; self; end
irb(main):004:1* def c; true; end
irb(main):005:0> end
irb(main):001* class A
irb(main):002* def inspect; '#<A>'; end
irb(main):003* def b; self; end
irb(main):004* def c; true; end
irb(main):005> end
=> :c
irb(main):006:0>
irb(main):007:0> a = A.new
irb(main):006>
irb(main):007> a = A.new
=> #<A>
irb(main):008:0>
irb(main):009:0> a
irb(main):010:0> .b
irb(main):011:0> # aaa
irb(main):012:0> .c
irb(main):008>
irb(main):009> a
irb(main):010> .b
irb(main):011> # aaa
irb(main):012> .c
=> true
irb(main):013:0>
irb(main):014:0> (a)
irb(main):015:0> &.b()
irb(main):013>
irb(main):014> (a)
irb(main):015> &.b()
=> #<A>
irb(main):016:0>
irb(main):017:0>
irb(main):018:0> class A def b; self; end; def c; true; end; end;
irb(main):019:0> a = A.new
irb(main):016>
irb(main):017>
irb(main):018> class A def b; self; end; def c; true; end; end;
irb(main):019> a = A.new
=> #<A>
irb(main):020:0> a
irb(main):021:0> .b
irb(main):022:0> # aaa
irb(main):023:0> .c
irb(main):020> a
irb(main):021> .b
irb(main):022> # aaa
irb(main):023> .c
=> true
irb(main):024:0> (a)
irb(main):025:0> &.b()
irb(main):024> (a)
irb(main):025> &.b()
=> #<A>
irb(main):026:0>
irb(main):026>
EOC
end

Expand All @@ -168,9 +168,9 @@ def test_symbol_with_backtick
close
assert_screen(<<~EOC)
start IRB
irb(main):001:0> :`
irb(main):001> :`
=> :`
irb(main):002:0>
irb(main):002>
EOC
end

Expand Down Expand Up @@ -243,11 +243,11 @@ def test_assignment_expression_truncate
close
assert_screen(<<~EOC)
start IRB
irb(main):001:0> #{code}
irb(main):001> #{code}
=>
[0,
...
irb(main):002:0>
irb(main):002>
EOC
end

Expand Down

0 comments on commit 3847532

Please sign in to comment.