remove debug
This commit is contained in:
29
ogui.ml
29
ogui.ml
@ -5,7 +5,6 @@ module Str = Re.Str
|
||||
|
||||
type stroke = { width : float; color : Gv.Color.t }
|
||||
|
||||
let debuglayout = ref false
|
||||
let stroke_none = { width = 0.; color = Gv.Color.transparent }
|
||||
|
||||
let pp_text_row : Gv.Text.text_row F.t =
|
||||
@ -537,10 +536,6 @@ module TextLayout = struct
|
||||
List.fold_left
|
||||
(fun (l : section list) sec ->
|
||||
let s, e = sec.byte_range in
|
||||
if !debuglayout then
|
||||
F.epr "with_range section cs=%d ce=%d s=%d e=%d@." cs ce
|
||||
s e;
|
||||
|
||||
l
|
||||
@ (if
|
||||
e < cs || ce < s
|
||||
@ -574,10 +569,6 @@ module TextLayout = struct
|
||||
let with_cursor (cur : cursor) ?(format = default_cursor_formatter)
|
||||
layout : layout =
|
||||
let c = with_range (cur.index, cur.index + 1) ~format layout in
|
||||
if !debuglayout then
|
||||
F.epr "with_cursor %a@."
|
||||
F.(brackets @@ list ~sep:cut pp_section)
|
||||
c.sections;
|
||||
c
|
||||
|
||||
let with_mark (mark : int option) (cur : int)
|
||||
@ -745,7 +736,7 @@ module TextEdit = struct
|
||||
unit Lwt.t =
|
||||
TextBuffer.fold_string text (fun s ->
|
||||
let slen = String.length s in
|
||||
(if cursor.index < scroll then
|
||||
if cursor.index < scroll then
|
||||
match
|
||||
String.rindex_from_opt s
|
||||
(min (slen - 1) (cursor.index - 1))
|
||||
@ -765,13 +756,7 @@ module TextEdit = struct
|
||||
rows
|
||||
with
|
||||
| None -> ()
|
||||
| Some i' -> t.scroll <- i'));
|
||||
F.epr
|
||||
"scroll_update slen=%d cursor=%d scroll=%d c-s=%d rows=%d@."
|
||||
(String.length s) t.cursor.index t.scroll
|
||||
(cursor.index - t.scroll)
|
||||
rows;
|
||||
debuglayout := true)
|
||||
| Some i' -> t.scroll <- i'))
|
||||
|
||||
let cursor_update (t : t) (f : int -> int) : unit Lwt.t =
|
||||
col t >>= fun last_col ->
|
||||
@ -1128,10 +1113,6 @@ module Painter = struct
|
||||
in
|
||||
Seq.fold_left
|
||||
(fun ((cur, start) : p2 * int) (row : Gv.Text.text_row) ->
|
||||
if !debuglayout then
|
||||
F.epr "start=%d row=%a %a @." start pp_text_row row
|
||||
F.(brackets @@ list TextLayout.pp_section)
|
||||
g.sections;
|
||||
let sections =
|
||||
List.filter
|
||||
(fun (r : TextLayout.section) ->
|
||||
@ -1184,7 +1165,6 @@ module Painter = struct
|
||||
let rec layout (box : box2) (ui : Ui.t) (frame : frame) : box2 Lwt.t
|
||||
=
|
||||
let box' = Margin.inner frame.style.margin box in
|
||||
if !debuglayout then F.epr "layout box'=%a@." Gg.Box2.pp box';
|
||||
(match frame.t with
|
||||
| `Box (dir, ll) ->
|
||||
Lwt_list.fold_left_s
|
||||
@ -1218,9 +1198,4 @@ module Painter = struct
|
||||
in
|
||||
draw_box ui.gv ~box:r' ~style:frame.style;
|
||||
Lwt.return r'
|
||||
|
||||
let layout a b c =
|
||||
let r = layout a b c in
|
||||
debuglayout := false;
|
||||
r
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user