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

ruby-changes:70905

From: aycabta <ko1@a...>
Date: Sun, 16 Jan 2022 22:09:50 +0900 (JST)
Subject: [ruby-changes:70905] 921ff739df (master): [ruby/reline] Insert newline in the middle of buffer just after dialog

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

From 921ff739df14c705491d75435c5e5ce31e2ed553 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Wed, 12 Jan 2022 19:46:33 +0900
Subject: [ruby/reline] Insert newline in the middle of buffer just after
 dialog

https://github.com/ruby/reline/commit/0c76631132
---
 lib/reline/line_editor.rb                   |  1 +
 test/reline/yamatanooroti/test_rendering.rb | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 70be8ac27a3..82bd36d4b3d 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -476,6 +476,7 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L476
         @just_cursor_moving = false
         return
       elsif @previous_line_index or new_highest_in_this != @highest_in_this
+        clear_dialog_with_content
         rerender_changed_current_line
         @previous_line_index = nil
         rendered = true
diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb
index 60d177d896d..4da61c20418 100644
--- a/test/reline/yamatanooroti/test_rendering.rb
+++ b/test/reline/yamatanooroti/test_rendering.rb
@@ -1289,6 +1289,27 @@ begin https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/test_rendering.rb#L1289
       EOC
     end
 
+    def test_insert_newline_in_the_middle_of_buffer_just_after_dialog
+      start_terminal(10, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --autocomplete}, startup_message: 'Multiline REPL.')
+      write("class A\n  def a\n    3\n  end\nend")
+      write("\n")
+      write("\C-p\C-p\C-p\C-p\C-p\C-e\C-hS")
+      write("\M-\x0D")
+      write("  3")
+      close
+      assert_screen(<<~'EOC')
+        prompt>   end
+        prompt> end
+        => :a
+        prompt> class S
+        prompt>   3
+        prompt>   def a
+        prompt>     3
+        prompt>   end
+        prompt> end
+      EOC
+    end
+
     def write_inputrc(content)
       File.open(@inputrc_file, 'w') do |f|
         f.write content
-- 
cgit v1.2.1


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

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