filter out identical completions;
authorwenzelm
Wed, 16 Dec 2009 15:15:05 +0100
changeset 34093 3d654643cf56
parent 34091 3aea0882879f
child 34094 61e19e96828f
filter out identical completions;
src/Pure/Thy/completion.scala
--- a/src/Pure/Thy/completion.scala	Wed Dec 16 14:15:24 2009 +0100
+++ b/src/Pure/Thy/completion.scala	Wed Dec 16 15:15:05 2009 +0100
@@ -116,13 +116,14 @@
     abbrevs_lex.parse(abbrevs_lex.keyword, new Completion.Reverse(line)) match {
       case abbrevs_lex.Success(rev_a, _) =>
         val (word, c) = abbrevs_map(rev_a)
-        Some(word, List(c))
+        if (word == c) None
+        else Some(word, List(c))
       case _ =>
         Completion.Parse.read(line) match {
           case Some(word) =>
-            words_lex.completions(word) match {
+            words_lex.completions(word).map(words_map(_)).filter(_ != word) match {
               case Nil => None
-              case cs => Some(word, cs.map(words_map(_)).sort(Completion.length_ord _))
+              case cs => Some (word, cs.sort(Completion.length_ord _))
             }
           case None => None
         }