ruby-changes:58330
From: Nobuyoshi <ko1@a...>
Date: Mon, 21 Oct 2019 09:54:59 +0900 (JST)
Subject: [ruby-changes:58330] 263ee6639d (master): Make suggestions order stable [Bug #16263]
https://git.ruby-lang.org/ruby.git/commit/?id=263ee6639d From 263ee6639d6f9f599613a20731c0646d125e0813 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 21 Oct 2019 09:12:38 +0900 Subject: Make suggestions order stable [Bug #16263] As the result order of `DidYouMean::SpellChecker#correct` is undefined, keep the order of the original candidates. diff --git a/lib/optparse.rb b/lib/optparse.rb index b028485..9745e4d 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -1787,7 +1787,7 @@ XXX https://github.com/ruby/ruby/blob/trunk/lib/optparse.rb#L1787 end all_candidates.select! {|cand| cand.is_a?(String) } checker = DidYouMean::SpellChecker.new(dictionary: all_candidates) - DidYouMean.formatter.message_for(checker.correct(opt)) + DidYouMean.formatter.message_for(all_candidates & checker.correct(opt)) end def candidate(word) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/