Skip to content

Commit

Permalink
Remove unused PROMPT_N (#685)
Browse files Browse the repository at this point in the history
  • Loading branch information
smmr0 authored Aug 20, 2023
1 parent 65e8e68 commit 66e69fa
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 36 deletions.
4 changes: 1 addition & 3 deletions doc/irb/irb.rd.ja
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ irb起動時に``~/.irbrc''を読み込みます. もし存在しない場合は

IRB.conf[:PROMPT][:MY_PROMPT] = { # プロンプトモードの名前
:PROMPT_I => nil, # 通常のプロンプト
:PROMPT_N => nil, # 継続行のプロンプト
:PROMPT_S => nil, # 文字列などの継続行のプロンプト
:PROMPT_C => nil, # 式が継続している時のプロンプト
:RETURN => " ==>%s\n" # リターン時のプロンプト
Expand All @@ -140,7 +139,7 @@ OKです.

IRB.conf[:PROMPT_MODE] = :MY_PROMPT

PROMPT_I, PROMPT_N, PROMPT_S, PROMPT_Cは, フォーマットを指定します.
PROMPT_I, PROMPT_S, PROMPT_Cは, フォーマットを指定します.

%N 起動しているコマンド名が出力される.
%m mainオブジェクト(self)がto_sで出力される.
Expand All @@ -155,7 +154,6 @@ PROMPT_I, PROMPT_N, PROMPT_S, PROMPT_Cは, フォーマットを指定します.

IRB.conf[:PROMPT][: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* ",
:RETURN => "=> %s\n"
Expand Down
9 changes: 0 additions & 9 deletions lib/irb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@
#
# IRB.conf[:PROMPT_MODE][:DEFAULT] = {
# :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 @@ -206,43 +205,37 @@
#
# # :NULL:
# # :PROMPT_I:
# # :PROMPT_N:
# # :PROMPT_S:
# # :PROMPT_C:
# # :RETURN: |
# # %s
# # :DEFAULT:
# # :PROMPT_I: ! '%N(%m):%03n> '
# # :PROMPT_N: ! '%N(%m):%03n> '
# # :PROMPT_S: ! '%N(%m):%03n%l '
# # :PROMPT_C: ! '%N(%m):%03n* '
# # :RETURN: |
# # => %s
# # :CLASSIC:
# # :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* '
# # :RETURN: |
# # %s
# # :SIMPLE:
# # :PROMPT_I: ! '>> '
# # :PROMPT_N: ! '>> '
# # :PROMPT_S:
# # :PROMPT_C: ! '?> '
# # :RETURN: |
# # => %s
# # :INF_RUBY:
# # :PROMPT_I: ! '%N(%m):%03n> '
# # :PROMPT_N:
# # :PROMPT_S:
# # :PROMPT_C:
# # :RETURN: |
# # %s
# # :AUTO_INDENT: true
# # :XMP:
# # :PROMPT_I:
# # :PROMPT_N:
# # :PROMPT_S:
# # :PROMPT_C:
# # :RETURN: |2
Expand Down Expand Up @@ -527,8 +520,6 @@ def eval_input
f = @context.prompt_s
elsif continue
f = @context.prompt_c
elsif indent > 0
f = @context.prompt_n
else
f = @context.prompt_i
end
Expand Down
3 changes: 0 additions & 3 deletions lib/irb/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@ def main
#
# See IRB@Customizing+the+IRB+Prompt for more information.
attr_accessor :prompt_c
# See IRB@Customizing+the+IRB+Prompt for more information.
attr_accessor :prompt_n
# Can be either the default <code>IRB.conf[:AUTO_INDENT]</code>, or the
# mode set by #prompt_mode=
#
Expand Down Expand Up @@ -414,7 +412,6 @@ def prompt_mode=(mode)
@prompt_i = pconf[:PROMPT_I]
@prompt_s = pconf[:PROMPT_S]
@prompt_c = pconf[:PROMPT_C]
@prompt_n = pconf[:PROMPT_N]
@return_format = pconf[:RETURN]
@return_format = "%s\n" if @return_format == nil
if ai = pconf.include?(:AUTO_INDENT)
Expand Down
6 changes: 0 additions & 6 deletions lib/irb/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,43 +58,37 @@ def IRB.init_config(ap_path)
@CONF[:PROMPT] = {
:NULL => {
:PROMPT_I => nil,
:PROMPT_N => nil,
:PROMPT_S => nil,
:PROMPT_C => nil,
:RETURN => "%s\n"
},
:DEFAULT => {
: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 => {
: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* ",
:RETURN => "%s\n"
},
:SIMPLE => {
:PROMPT_I => ">> ",
:PROMPT_N => ">> ",
:PROMPT_S => "%l> ",
:PROMPT_C => "?> ",
:RETURN => "=> %s\n"
},
:INF_RUBY => {
:PROMPT_I => "%N(%m):%03n> ",
:PROMPT_N => nil,
:PROMPT_S => nil,
:PROMPT_C => nil,
:RETURN => "%s\n",
:AUTO_INDENT => true
},
:XMP => {
:PROMPT_I => nil,
:PROMPT_N => nil,
:PROMPT_S => nil,
:PROMPT_C => nil,
:RETURN => " ==>%s\n"
Expand Down
18 changes: 6 additions & 12 deletions test/irb/test_cmd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,7 @@ def test_measure
DEFAULT: {
PROMPT_I: '> ',
PROMPT_S: '> ',
PROMPT_C: '> ',
PROMPT_N: '> '
PROMPT_C: '> '
}
},
PROMPT_MODE: :DEFAULT,
Expand Down Expand Up @@ -258,8 +257,7 @@ def test_measure_keeps_previous_value
DEFAULT: {
PROMPT_I: '> ',
PROMPT_S: '> ',
PROMPT_C: '> ',
PROMPT_N: '> '
PROMPT_C: '> '
}
},
PROMPT_MODE: :DEFAULT,
Expand All @@ -286,8 +284,7 @@ def test_measure_enabled_by_rc
DEFAULT: {
PROMPT_I: '> ',
PROMPT_S: '> ',
PROMPT_C: '> ',
PROMPT_N: '> '
PROMPT_C: '> '
}
},
PROMPT_MODE: :DEFAULT,
Expand Down Expand Up @@ -317,8 +314,7 @@ def test_measure_enabled_by_rc_with_custom
DEFAULT: {
PROMPT_I: '> ',
PROMPT_S: '> ',
PROMPT_C: '> ',
PROMPT_N: '> '
PROMPT_C: '> '
}
},
PROMPT_MODE: :DEFAULT,
Expand Down Expand Up @@ -348,8 +344,7 @@ def test_measure_with_custom
DEFAULT: {
PROMPT_I: '> ',
PROMPT_S: '> ',
PROMPT_C: '> ',
PROMPT_N: '> '
PROMPT_C: '> '
}
},
PROMPT_MODE: :DEFAULT,
Expand All @@ -375,8 +370,7 @@ def test_measure_with_proc
DEFAULT: {
PROMPT_I: '> ',
PROMPT_S: '> ',
PROMPT_C: '> ',
PROMPT_N: '> '
PROMPT_C: '> '
}
},
PROMPT_MODE: :DEFAULT,
Expand Down
1 change: 0 additions & 1 deletion test/irb/test_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ def main.inspect
def test_default_return_format
IRB.conf[:PROMPT][:MY_PROMPT] = {
:PROMPT_I => "%03n> ",
:PROMPT_N => "%03n> ",
:PROMPT_S => "%03n> ",
:PROMPT_C => "%03n> "
# without :RETURN
Expand Down
2 changes: 0 additions & 2 deletions test/irb/yamatanooroti/test_rendering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ def test_autocomplete_with_showdoc_in_gaps_on_narrow_screen_right
write_irbrc <<~'LINES'
IRB.conf[:PROMPT][:MY_PROMPT] = {
:PROMPT_I => "%03n> ",
:PROMPT_N => "%03n> ",
:PROMPT_S => "%03n> ",
:PROMPT_C => "%03n> "
}
Expand Down Expand Up @@ -214,7 +213,6 @@ def test_autocomplete_with_showdoc_in_gaps_on_narrow_screen_left
write_irbrc <<~'LINES'
IRB.conf[:PROMPT][:MY_PROMPT] = {
:PROMPT_I => "%03n> ",
:PROMPT_N => "%03n> ",
:PROMPT_S => "%03n> ",
:PROMPT_C => "%03n> "
}
Expand Down

0 comments on commit 66e69fa

Please sign in to comment.