[前][次][番号順一覧][スレッド一覧]

ruby-changes:64787

From: aycabta <ko1@a...>
Date: Fri, 8 Jan 2021 13:38:38 +0900 (JST)
Subject: [ruby-changes:64787] ea75aed98e (master): [ruby/reline] Correct var names in Reline were different from vi-*-mode-string

https://git.ruby-lang.org/ruby.git/commit/?id=ea75aed98e

From ea75aed98e7382f6a548d0c3c5ac89abbe5f086f Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Tue, 29 Dec 2020 13:28:14 +0900
Subject: [ruby/reline] Correct var names in Reline were different from
 vi-*-mode-string

https://github.com/ruby/reline/commit/8255fc93b9

diff --git a/lib/reline/config.rb b/lib/reline/config.rb
index 4141031..63ab7b7 100644
--- a/lib/reline/config.rb
+++ b/lib/reline/config.rb
@@ -34,8 +34,8 @@ class Reline::Config https://github.com/ruby/ruby/blob/trunk/lib/reline/config.rb#L34
     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 https://github.com/ruby/ruby/blob/trunk/lib/reline/config.rb#L56
     @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 https://github.com/ruby/ruby/blob/trunk/lib/reline/config.rb#L270
         @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 5b59835..10c94db 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -68,24 +68,24 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L68
     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 https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L99
       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 https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L119
         @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 https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L218
     @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 3ba157a..5c5f06a 100644
--- a/test/reline/yamatanooroti/test_rendering.rb
+++ b/test/reline/yamatanooroti/test_rendering.rb
@@ -152,7 +152,7 @@ begin https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/test_rendering.rb#L152
       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 https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/test_rendering.rb#L164
       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 https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/test_rendering.rb#L180
       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 https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/test_rendering.rb#L193
       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 https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/test_rendering.rb#L206
       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 https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/test_rendering.rb#L224
       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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]