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

ruby-changes:65310

From: Yoshinao <ko1@a...>
Date: Sun, 21 Feb 2021 07:04:12 +0900 (JST)
Subject: [ruby-changes:65310] 38cefac7ce (master): [ruby/reline] We still need support new and legacy behavior.

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

From 38cefac7ce277d8ea41c600e67a2046da3715ac3 Mon Sep 17 00:00:00 2001
From: Yoshinao Muramatu <ysno@a...>
Date: Wed, 17 Feb 2021 23:28:47 +0900
Subject: [ruby/reline] We still need support new and legacy behavior. Revert
 "Support for change in Windows-specific behavior at eol"

This reverts commit cad4de6ee841b43f3f0e441626f9415c3eda0f82.

https://github.com/ruby/reline/commit/646587fc2c
---
 lib/reline/line_editor.rb | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 793cad7..9987732 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -725,13 +725,17 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L725
       Reline::IOGate.move_cursor_column(0)
       if line.nil?
         if calculate_width(visual_lines[index - 1], true) == Reline::IOGate.get_screen_size.last
-          # Reaches the end of line.
-          #
-          # When the cursor is at the end of the line and erases characters
-          # after the cursor, some terminals delete the character at the
-          # cursor position.
-          move_cursor_down(1)
-          Reline::IOGate.move_cursor_column(0)
+          # reaches the end of line
+          if Reline::IOGate.win?
+            # A newline is automatically inserted if a character is rendered at
+            # eol on command prompt.
+          else
+            # When the cursor is at the end of the line and erases characters
+            # after the cursor, some terminals delete the character at the
+            # cursor position.
+            move_cursor_down(1)
+            Reline::IOGate.move_cursor_column(0)
+          end
         else
           Reline::IOGate.erase_after_cursor
           move_cursor_down(1)
@@ -740,6 +744,10 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L744
         next
       end
       @output.write line
+      if Reline::IOGate.win? and calculate_width(line, true) == Reline::IOGate.get_screen_size.last
+        # A newline is automatically inserted if a character is rendered at eol on command prompt.
+        @rest_height -= 1 if @rest_height > 0
+      end
       @output.flush
       if @first_prompt
         @first_prompt = false
-- 
cgit v1.1


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

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