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

ruby-changes:70904

From: aycabta <ko1@a...>
Date: Sun, 16 Jan 2022 22:09:49 +0900 (JST)
Subject: [ruby-changes:70904] 2bc6b07a8d (master): [ruby/reline] Combine common logic into one

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

From 2bc6b07a8d313b6aa9dea13d81ffd3c97db84ead Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Fri, 7 Jan 2022 22:59:55 +0900
Subject: [ruby/reline] Combine common logic into one

https://github.com/ruby/reline/commit/5db9738f17
---
 lib/reline/line_editor.rb | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 295af526fe9..70be8ac27a3 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -466,20 +466,12 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L466
     new_highest_in_this = calculate_height_by_width(prompt_width + calculate_width(@line.nil? ? '' : @line))
     rendered = false
     if @add_newline_to_end_of_buffer
-      @dialogs.each do |dialog|
-        clear_each_dialog(dialog)
-        dialog.contents = nil
-        dialog.trap_key = nil
-      end
+      clear_dialog_with_content
       rerender_added_newline(prompt, prompt_width)
       @add_newline_to_end_of_buffer = false
     else
       if @just_cursor_moving and not @rerender_all
-        @dialogs.each do |dialog|
-          clear_each_dialog(dialog)
-          dialog.contents = nil
-          dialog.trap_key = nil
-        end
+        clear_dialog_with_content
         rendered = just_move_cursor
         @just_cursor_moving = false
         return
@@ -892,6 +884,14 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L884
     end
   end
 
+  private def clear_dialog_with_content
+    @dialogs.each do |dialog|
+      clear_each_dialog(dialog)
+      dialog.contents = nil
+      dialog.trap_key = nil
+    end
+  end
+
   private def clear_each_dialog(dialog)
     dialog.trap_key = nil
     return unless dialog.contents
-- 
cgit v1.2.1


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

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