[ruby/reline] Correct var names in Reline were different from vi-*-mode-string

https://github.com/ruby/reline/commit/8255fc93b9
This commit is contained in:
aycabta 2020-12-29 13:28:14 +09:00
Родитель 54c1dcba2b
Коммит ea75aed98e
3 изменённых файлов: 28 добавлений и 28 удалений

Просмотреть файл

@ -34,8 +34,8 @@ class Reline::Config
show-all-if-unmodified
visible-stats
show-mode-in-prompt
vi-cmd-mode-icon
vi-ins-mode-icon
vi-cmd-mode-string
vi-ins-mode-string
emacs-mode-string
enable-bracketed-paste
isearch-terminators
@ -56,8 +56,8 @@ class Reline::Config
@key_actors[:emacs] = Reline::KeyActor::Emacs.new
@key_actors[:vi_insert] = Reline::KeyActor::ViInsert.new
@key_actors[:vi_command] = Reline::KeyActor::ViCommand.new
@vi_cmd_mode_icon = '(cmd)'
@vi_ins_mode_icon = '(ins)'
@vi_cmd_mode_string = '(cmd)'
@vi_ins_mode_string = '(ins)'
@emacs_mode_string = '@'
# https://tiswww.case.edu/php/chet/readline/readline.html#IDX25
@history_size = -1 # unlimited
@ -270,9 +270,9 @@ class Reline::Config
@show_mode_in_prompt = false
end
when 'vi-cmd-mode-string'
@vi_cmd_mode_icon = retrieve_string(value)
@vi_cmd_mode_string = retrieve_string(value)
when 'vi-ins-mode-string'
@vi_ins_mode_icon = retrieve_string(value)
@vi_ins_mode_string = retrieve_string(value)
when 'emacs-mode-string'
@emacs_mode_string = retrieve_string(value)
when *VARIABLE_NAMES then

Просмотреть файл

@ -68,24 +68,24 @@ class Reline::LineEditor
end
end
private def check_mode_icon
mode_icon = nil
private def check_mode_string
mode_string = nil
if @config.show_mode_in_prompt
if @config.editing_mode_is?(:vi_command)
mode_icon = @config.vi_cmd_mode_icon
mode_string = @config.vi_cmd_mode_string
elsif @config.editing_mode_is?(:vi_insert)
mode_icon = @config.vi_ins_mode_icon
mode_string = @config.vi_ins_mode_string
elsif @config.editing_mode_is?(:emacs)
mode_icon = @config.emacs_mode_string
mode_string = @config.emacs_mode_string
else
mode_icon = '?'
mode_string = '?'
end
end
if mode_icon != @prev_mode_icon
if mode_string != @prev_mode_string
@rerender_all = true
end
@prev_mode_icon = mode_icon
mode_icon
@prev_mode_string = mode_string
mode_string
end
private def check_multiline_prompt(buffer, prompt)
@ -99,8 +99,8 @@ class Reline::LineEditor
prompt = @prompt
end
if simplified_rendering?
mode_icon = check_mode_icon
prompt = mode_icon + prompt if mode_icon
mode_string = check_mode_string
prompt = mode_string + prompt if mode_string
return [prompt, calculate_width(prompt, true), [prompt] * buffer.size]
end
if @prompt_proc
@ -119,15 +119,15 @@ class Reline::LineEditor
@prompt_cache_time = Time.now.to_f
end
prompt_list.map!{ prompt } if @vi_arg or @searching_prompt
mode_icon = check_mode_icon
prompt_list = prompt_list.map{ |pr| mode_icon + pr } if mode_icon
mode_string = check_mode_string
prompt_list = prompt_list.map{ |pr| mode_string + pr } if mode_string
prompt = prompt_list[@line_index]
prompt = prompt_list[0] if prompt.nil?
prompt_width = calculate_width(prompt, true)
[prompt, prompt_width, prompt_list]
else
mode_icon = check_mode_icon
prompt = mode_icon + prompt if mode_icon
mode_string = check_mode_string
prompt = mode_string + prompt if mode_string
prompt_width = calculate_width(prompt, true)
[prompt, prompt_width, nil]
end
@ -218,7 +218,7 @@ class Reline::LineEditor
@eof = false
@continuous_insertion_buffer = String.new(encoding: @encoding)
@scroll_partial_screen = nil
@prev_mode_icon = nil
@prev_mode_string = nil
@drop_terminate_spaces = false
reset_line
end

Просмотреть файл

@ -152,7 +152,7 @@ begin
EOC
end
def test_mode_icon_emacs
def test_mode_string_emacs
write_inputrc <<~LINES
set show-mode-in-prompt on
LINES
@ -164,7 +164,7 @@ begin
EOC
end
def test_mode_icon_vi
def test_mode_string_vi
write_inputrc <<~LINES
set editing-mode vi
set show-mode-in-prompt on
@ -180,7 +180,7 @@ begin
EOC
end
def test_original_mode_icon_emacs
def test_original_mode_string_emacs
write_inputrc <<~LINES
set show-mode-in-prompt on
set emacs-mode-string [emacs]
@ -193,7 +193,7 @@ begin
EOC
end
def test_original_mode_icon_with_quote
def test_original_mode_string_with_quote
write_inputrc <<~LINES
set show-mode-in-prompt on
set emacs-mode-string "[emacs]"
@ -206,7 +206,7 @@ begin
EOC
end
def test_original_mode_icon_vi
def test_original_mode_string_vi
write_inputrc <<~LINES
set editing-mode vi
set show-mode-in-prompt on
@ -224,7 +224,7 @@ begin
EOC
end
def test_mode_icon_vi_changing
def test_mode_string_vi_changing
write_inputrc <<~LINES
set editing-mode vi
set show-mode-in-prompt on