summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2020-12-29 13:28:14 +0900
committeraycabta <aycabta@gmail.com>2021-01-08 13:25:18 +0900
commitea75aed98e7382f6a548d0c3c5ac89abbe5f086f (patch)
tree0643513136e0b2167ff861e2dba77d5f66ac2d41
parent54c1dcba2ba670c671afe5c2dc3213d74f57e0e3 (diff)
[ruby/reline] Correct var names in Reline were different from vi-*-mode-string
https://github.com/ruby/reline/commit/8255fc93b9
-rw-r--r--lib/reline/config.rb12
-rw-r--r--lib/reline/line_editor.rb32
-rw-r--r--test/reline/yamatanooroti/test_rendering.rb12
3 files changed, 28 insertions, 28 deletions
diff --git a/lib/reline/config.rb b/lib/reline/config.rb
index 4141031912..63ab7b7402 100644
--- a/lib/reline/config.rb
+++ b/lib/reline/config.rb
@@ -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
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 5b598357e5..10c94db753 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -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
diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb
index 3ba157a7ef..5c5f06a48d 100644
--- a/test/reline/yamatanooroti/test_rendering.rb
+++ b/test/reline/yamatanooroti/test_rendering.rb
@@ -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