src/Tools/VSCode/src/vscode_resources.scala
changeset 65191 4c9c83311cad
parent 65189 41d2452845fc
child 65196 e8760a98db78
equal deleted inserted replaced
65190:0dd2ad9dbfc2 65191:4c9c83311cad
   275   def output_pretty_message(body: XML.Body): String = output_pretty(body, message_margin)
   275   def output_pretty_message(body: XML.Body): String = output_pretty(body, message_margin)
   276 
   276 
   277 
   277 
   278   /* caret handling */
   278   /* caret handling */
   279 
   279 
   280   def update_caret(new_caret: Option[(JFile, Line.Position)])
   280   def update_caret(caret: Option[(JFile, Line.Position)])
   281   { state.change(_.copy(caret = new_caret)) }
   281   { state.change(_.copy(caret = caret)) }
   282 
   282 
   283   def caret_position: Option[(Document_Model, Line.Position)] =
   283   def caret_range(): Option[(Document_Model, Text.Range)] =
   284   {
   284   {
   285     val st = state.value
   285     val st = state.value
   286     for {
   286     for {
   287       (file, pos) <- st.caret
   287       (file, pos) <- st.caret
   288       model <- st.models.get(file)
   288       model <- st.models.get(file)
       
   289       offset <- model.content.doc.offset(pos)
       
   290       if offset < model.content.doc.text_range.stop
   289     }
   291     }
   290     yield (model, pos)
   292     yield (model, Text.Range(offset, offset + 1))
   291   }
   293   }
   292 
   294 
   293 
   295 
   294   /* spell checker */
   296   /* spell checker */
   295 
   297