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

ruby-changes:59618

From: KOBAYASHI <ko1@a...>
Date: Sun, 5 Jan 2020 11:37:22 +0900 (JST)
Subject: [ruby-changes:59618] 9b928fa443 (master): [ruby/reline] Sort completion list

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

From 9b928fa4437139147602bc62b3aaabdc87f7ff0b Mon Sep 17 00:00:00 2001
From: KOBAYASHI Shuji <shuujii@g...>
Date: Fri, 27 Dec 2019 13:41:22 +0900
Subject: [ruby/reline] Sort completion list

#### Legacy mode:

  ```console
  $ irb --legacy
  irb(main):001:0> l[TAB][TAB]
  lambda           load             local_variables  loop
  ```

#### Before this patch:

  ```console
  $ irb
  irb(main):001:0> l[TAB][TAB]
  local_variables
  loop
  lambda
  load
  ```

#### After this patch:

  ```console
  $ irb
  irb(main):001:0> l[TAB][TAB]
  lambda
  load
  local_variables
  loop
  ```

https://github.com/ruby/reline/commit/6074069c7d

diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 3f6d781..b46eddf 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -317,7 +317,7 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L317
     if @menu_info
       scroll_down(@highest_in_all - @first_line_started_from)
       @rerender_all = true
-      @menu_info.list.each do |item|
+      @menu_info.list.sort!.each do |item|
         Reline::IOGate.move_cursor_column(0)
         @output.print item
         @output.flush
-- 
cgit v0.10.2


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

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