ruby-changes:64003
From: aycabta <ko1@a...>
Date: Tue, 8 Dec 2020 00:13:01 +0900 (JST)
Subject: [ruby-changes:64003] 3bf7b999e5 (master): [ruby/reline] Editing to initial content is not just cursor moving
https://git.ruby-lang.org/ruby.git/commit/?id=3bf7b999e5 From 3bf7b999e503199e2e9fe68ade25ee6830b3e57e Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Sun, 6 Dec 2020 17:45:05 +0900 Subject: [ruby/reline] Editing to initial content is not just cursor moving https://github.com/ruby/reline/commit/0a4f175b0a diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index f8be32e..236993f 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -933,6 +933,7 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L933 finish return end + old_line = @line.dup @first_char = false completion_occurs = false if @config.editing_mode_is?(:emacs, :vi_insert) and key.char == "\C-i".ord @@ -964,7 +965,7 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L965 if not Reline::IOGate.in_pasting? and @just_cursor_moving.nil? if @previous_line_index and @buffer_of_lines[@previous_line_index] == @line @just_cursor_moving = true - elsif @previous_line_index.nil? and @buffer_of_lines[@line_index] == @line + elsif @previous_line_index.nil? and @buffer_of_lines[@line_index] == @line and old_line == @line @just_cursor_moving = true else @just_cursor_moving = false diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb index 84c0580..1dc5ac3 100644 --- a/test/reline/yamatanooroti/test_rendering.rb +++ b/test/reline/yamatanooroti/test_rendering.rb @@ -441,6 +441,17 @@ begin https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/test_rendering.rb#L441 EOC end + def test_backspace_until_returns_to_initial + start_terminal(5, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/bin/multiline_repl}, startup_message: 'Multiline REPL.') + write("ABC") + write("\C-h\C-h\C-h") + close + assert_screen(<<~EOC) + Multiline REPL. + prompt> + EOC + end + private def write_inputrc(content) File.open(@inputrc_file, 'w') do |f| f.write content -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/