summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-10-21 09:12:38 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-10-21 09:54:11 +0900
commit263ee6639d6f9f599613a20731c0646d125e0813 (patch)
tree4133ba914924764fdd3a748308386f96aa86e970 /lib
parent71ffe40a447a17a1c3388374b7c9979c826b131d (diff)
Make suggestions order stable [Bug #16263]
As the result order of `DidYouMean::SpellChecker#correct` is undefined, keep the order of the original candidates.
Diffstat (limited to 'lib')
-rw-r--r--lib/optparse.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/optparse.rb b/lib/optparse.rb
index b0284850cf..9745e4d662 100644
--- a/lib/optparse.rb
+++ b/lib/optparse.rb
@@ -1787,7 +1787,7 @@ XXX
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)