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

ruby-changes:65733

From: aycabta <ko1@a...>
Date: Fri, 2 Apr 2021 17:39:58 +0900 (JST)
Subject: [ruby-changes:65733] 7e93917458 (master): [ruby/reline] Reset @rest_height when clear screen

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

From 7e93917458cdc67399e82233ff0f13e3c8bd7065 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Fri, 2 Apr 2021 17:18:37 +0900
Subject: [ruby/reline] Reset @rest_height when clear screen

https://github.com/ruby/reline/commit/3a7019b0d5
---
 lib/reline/line_editor.rb                   |  1 +
 test/reline/yamatanooroti/test_rendering.rb | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 5a2a3f1..7d71e62 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -813,6 +813,7 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L813
     end
     move_cursor_up(back)
     move_cursor_down(@first_line_started_from + @started_from)
+    @rest_height = (Reline::IOGate.get_screen_size.first - 1) - Reline::IOGate.cursor_pos.y
     Reline::IOGate.move_cursor_column((prompt_width + @cursor) % @screen_size.last)
   end
 
diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb
index 6f9a14d..13693e7 100644
--- a/test/reline/yamatanooroti/test_rendering.rb
+++ b/test/reline/yamatanooroti/test_rendering.rb
@@ -719,6 +719,17 @@ begin https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/test_rendering.rb#L719
       EOC
     end
 
+    def test_reset_rest_height_when_clear_screen
+      start_terminal(5, 20, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl}, startup_message: 'Multiline REPL.')
+      write("\n\n\n\C-l3\n")
+      close
+      assert_screen(<<~EOC)
+        prompt> 3
+        => 3
+        prompt>
+      EOC
+    end
+
     private def write_inputrc(content)
       File.open(@inputrc_file, 'w') do |f|
         f.write content
-- 
cgit v1.1


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

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