5 let line_start ?pos (text : GEdit.text) =
6 let pos = Gaux.default text#position ~opt:pos in
8 let start = max 0 (pos-256) in
9 let buffer = text#get_chars ~start ~stop:pos in
10 try start + String.rindex buffer '\n' with Not_found -> 0
12 let line_end ?pos (text : GEdit.text) =
13 let pos = Gaux.default text#position ~opt:pos in
14 if pos = text#length then text#length else
15 let buffer = text#get_chars ~start:pos ~stop:(min text#length (pos+256)) in
16 try pos + String.index buffer '\n' with Not_found -> text#length