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

ruby-changes:58277

From: aycabta <ko1@a...>
Date: Wed, 16 Oct 2019 22:37:01 +0900 (JST)
Subject: [ruby-changes:58277] 7df227804a (master): Support multiline history in incremental search

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

From 7df227804af8eefac9d82cf449cab09c086aea60 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Wed, 16 Oct 2019 22:34:58 +0900
Subject: Support multiline history in incremental search


diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 9223e55..a62ed0e 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -1191,11 +1191,25 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L1191
           end
         end
         if hit
-          @searching_prompt = "(reverse-i-search)`%s': %s" % [search_word, hit]
-          @line = hit
+          if @is_multiline
+            @buffer_of_lines = hit.split("\n")
+            @buffer_of_lines = [String.new(encoding: @encoding)] if @buffer_of_lines.empty?
+            @line_index = @buffer_of_lines.size - 1
+            @line = @buffer_of_lines.last
+            @rerender_all = true
+            @searching_prompt = "(reverse-i-search)`%s'" % [search_word]
+          else
+            @line = hit
+            @searching_prompt = "(reverse-i-search)`%s': %s" % [search_word, hit]
+          end
           last_hit = hit
         else
-          @searching_prompt = "(failed reverse-i-search)`%s': %s" % [search_word, last_hit]
+          if @is_multiline
+            @rerender_all = true
+            @searching_prompt = "(failed reverse-i-search)`%s'" % [search_word]
+          else
+            @searching_prompt = "(failed reverse-i-search)`%s': %s" % [search_word, last_hit]
+          end
         end
       end
     end
-- 
cgit v0.10.2


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

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