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

ruby-changes:62899

From: aycabta <ko1@a...>
Date: Sat, 12 Sep 2020 08:38:52 +0900 (JST)
Subject: [ruby-changes:62899] 0ec19cc843 (master): [ruby/reline] Stop erasing chars after the cursor at eol

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

From 0ec19cc8435fb3f04c503af374942a2ea74b0e46 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Wed, 9 Sep 2020 19:46:30 +0900
Subject: [ruby/reline] Stop erasing chars after the cursor at eol

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.

https://github.com/ruby/reline/commit/e96ec97b02

diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index b4d2b45..fe088a4 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -492,8 +492,18 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L492
     Reline::IOGate.move_cursor_column(0)
     visual_lines.each_with_index do |line, index|
       if line.nil?
-        if Reline::IOGate.win? and calculate_width(visual_lines[index - 1], true) == Reline::IOGate.get_screen_size.last
-          # A newline is automatically inserted if a character is rendered at eol on command prompt.
+        if calculate_width(visual_lines[index - 1], true) == Reline::IOGate.get_screen_size.last
+          # 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)
-- 
cgit v0.10.2


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

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