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

ruby-changes:65163

From: aycabta <ko1@a...>
Date: Sun, 7 Feb 2021 05:16:46 +0900 (JST)
Subject: [ruby-changes:65163] bd0f8b36fd (master): [ruby/reline] Show all lines higher than the screen when finished

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

From bd0f8b36fd31951a23f918074a2ba2c95c55a28a Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Sun, 31 Jan 2021 13:45:21 +0900
Subject: [ruby/reline] Show all lines higher than the screen when finished

On Unix-like OSes, logs prior to the screen are not editable. When the code
is higher than the screen, the code is only shown on the screen until input
is finished, but when it is finished, all lines are outputted.

https://github.com/ruby/reline/commit/8cd9132a39
---
 lib/reline/line_editor.rb | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 1017dc6..47ffe4d 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -388,6 +388,19 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L388
       @cleared = false
       return
     end
+    if @is_multiline and finished? and @scroll_partial_screen
+      # Re-output all code higher than the screen when finished.
+      Reline::IOGate.move_cursor_up(@first_line_started_from + @started_from - @scroll_partial_screen)
+      Reline::IOGate.move_cursor_column(0)
+      @scroll_partial_screen = nil
+      prompt, prompt_width, prompt_list = check_multiline_prompt(whole_lines, prompt)
+      modify_lines(whole_lines).each_with_index do |line, index|
+        @output.write "#{prompt_list ? prompt_list[index] : prompt}#{line}\n"
+        Reline::IOGate.erase_after_cursor
+      end
+      @output.flush
+      return
+    end
     new_highest_in_this = calculate_height_by_width(prompt_width + calculate_width(@line.nil? ? '' : @line))
     # FIXME: end of logical line sometimes breaks
     rendered = false
-- 
cgit v1.1


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

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