src/Tools/jEdit/src/text_structure.scala
changeset 66175 09fe6ae94331
parent 66173 6c71a3af85a3
child 66176 b51a40281016
equal deleted inserted replaced
66174:8903653fc22e 66175:09fe6ae94331
   185       }
   185       }
   186     }
   186     }
   187   }
   187   }
   188 
   188 
   189   def line_content(buffer: JEditBuffer, keywords: Keyword.Keywords,
   189   def line_content(buffer: JEditBuffer, keywords: Keyword.Keywords,
   190     range: Text.Range, context: Scan.Line_Context): (List[Token], Scan.Line_Context) =
   190     range: Text.Range, ctxt: Scan.Line_Context): (List[Token], Scan.Line_Context) =
   191   {
   191   {
   192     val text = JEdit_Lib.try_get_text(buffer, range).getOrElse("")
   192     val text = JEdit_Lib.try_get_text(buffer, range).getOrElse("")
   193     val (toks, context1) = Token.explode_line(keywords, text, context)
   193     val (toks, ctxt1) = Token.explode_line(keywords, text, ctxt)
   194     val toks1 = toks.filterNot(_.is_space)
   194     val toks1 = toks.filterNot(_.is_space)
   195     (toks1, context1)
   195     (toks1, ctxt1)
   196   }
   196   }
   197 
   197 
   198   def split_line_content(buffer: JEditBuffer, keywords: Keyword.Keywords, line: Int, caret: Int)
   198   def split_line_content(buffer: JEditBuffer, keywords: Keyword.Keywords, line: Int, caret: Int)
   199     : (List[Token], List[Token]) =
   199     : (List[Token], List[Token]) =
   200   {
   200   {
   201     val line_range = JEdit_Lib.line_range(buffer, line)
   201     val line_range = JEdit_Lib.line_range(buffer, line)
   202     val context0 = Token_Markup.Line_Context.prev(buffer, line).get_context
   202     val ctxt0 = Token_Markup.Line_Context.prev(buffer, line).get_context
   203 
   203     val (toks1, ctxt1) = line_content(buffer, keywords, Text.Range(line_range.start, caret), ctxt0)
   204     val (toks1, context1) =
   204     val (toks2, _) = line_content(buffer, keywords, Text.Range(caret, line_range.stop), ctxt1)
   205       line_content(buffer, keywords, Text.Range(line_range.start, caret), context0)
       
   206     val (toks2, _) =
       
   207       line_content(buffer, keywords, Text.Range(caret, line_range.stop), context1)
       
   208     (toks1, toks2)
   205     (toks1, toks2)
   209   }
   206   }
   210 
   207 
   211 
   208 
   212   /* structure matching */
   209   /* structure matching */