--- a/src/Tools/jEdit/src/rendering.scala Sun Feb 23 15:38:21 2014 +0100
+++ b/src/Tools/jEdit/src/rendering.scala Sun Feb 23 16:08:38 2014 +0100
@@ -273,41 +273,27 @@
/* completion */
- def completion_range(caret: Text.Offset): Option[Text.Range] =
- if (!snapshot.is_outdated) {
- snapshot.select(Text.Range(caret - 1, caret + 1), Rendering.completion_names_elements, _ =>
- {
- case Completion.Names.Info(names) => Some(names.range)
- case _ => None
- }).headOption.map(_.info)
- }
- else None
-
- def completion_names(caret: Text.Offset): Option[Completion.Names] =
- if (caret > 0 && !snapshot.is_outdated)
- {
- snapshot.select(Text.Range(caret - 1, caret + 1), Rendering.completion_names_elements, _ =>
+ def completion_names(range: Text.Range): Option[Completion.Names] =
+ if (snapshot.is_outdated) None
+ else {
+ snapshot.select(range, Rendering.completion_names_elements, _ =>
{
case Completion.Names.Info(names) => Some(names)
case _ => None
}).headOption.map(_.info)
}
- else None
- def completion_context(caret: Text.Offset): Option[Completion.Context] =
- if (caret > 0) {
- snapshot.select(Text.Range(caret - 1, caret + 1), Rendering.completion_context_elements, _ =>
- {
- case Text.Info(_, elem)
- if elem.name == Markup.ML_STRING || elem.name == Markup.ML_COMMENT =>
- Some(Completion.Context.ML_inner)
- case Text.Info(_, XML.Elem(Markup.Language(language, symbols, antiquotes), _)) =>
- Some(Completion.Context(language, symbols, antiquotes))
- case Text.Info(_, _) =>
- Some(Completion.Context.inner)
- }).headOption.map(_.info)
- }
- else None
+ def completion_context(range: Text.Range): Option[Completion.Context] =
+ snapshot.select(range, Rendering.completion_context_elements, _ =>
+ {
+ case Text.Info(_, elem)
+ if elem.name == Markup.ML_STRING || elem.name == Markup.ML_COMMENT =>
+ Some(Completion.Context.ML_inner)
+ case Text.Info(_, XML.Elem(Markup.Language(language, symbols, antiquotes), _)) =>
+ Some(Completion.Context(language, symbols, antiquotes))
+ case Text.Info(_, _) =>
+ Some(Completion.Context.inner)
+ }).headOption.map(_.info)
/* command status overview */