src/Tools/jEdit/src/jedit_lib.scala
changeset 55551 5c40782f68b3
parent 53786 064cb0458071
child 55690 d73949233c2e
equal deleted inserted replaced
55550:a645277885cf 55551:5c40782f68b3
   220 
   220 
   221     val (p, q, r) =
   221     val (p, q, r) =
   222       try {
   222       try {
   223         val p = text_area.offsetToXY(range.start)
   223         val p = text_area.offsetToXY(range.start)
   224         val (q, r) =
   224         val (q, r) =
   225           if (stop >= end) (text_area.offsetToXY(end), char_width * (stop - end))
   225           if (try_get_text(buffer, Text.Range(stop - 1, stop)) == Some("\n"))
   226           else if (stop > 0 && buffer.getText(stop - 1, 1) == "\n")
       
   227             (text_area.offsetToXY(stop - 1), char_width)
   226             (text_area.offsetToXY(stop - 1), char_width)
       
   227           else if (stop >= end)
       
   228             (text_area.offsetToXY(end), char_width * (stop - end))
   228           else (text_area.offsetToXY(stop), 0)
   229           else (text_area.offsetToXY(stop), 0)
   229         (p, q, r)
   230         (p, q, r)
   230       }
   231       }
   231       catch { case _: ArrayIndexOutOfBoundsException => (null, null, 0) }
   232       catch { case _: ArrayIndexOutOfBoundsException => (null, null, 0) }
   232 
   233