--- otags-3.06.6.original/vi.ml 2003-02-26 00:12:40.000000000 -0800 +++ otags-3.06.6/vi.ml 2003-02-26 00:25:12.000000000 -0800 @@ -7,7 +7,7 @@ let sized_string_of_file f taille = let buf = String.create taille in - let cin = open_in f in + let cin = open_in_bin f in let rec loop lus0 t0 = let n = input cin buf lus0 t0 in let lus = lus0 + n in let t = t0 - n in @@ -62,7 +62,7 @@ let buffer = Buffer.create (String.length part_es) in String.iter (fun c -> match c with - | '$' | '/' | '\\' -> + | '$' | '/' -> Buffer.add_char buffer '\\'; Buffer.add_char buffer c | _ -> Buffer.add_char buffer c) @@ -79,9 +79,13 @@ | [] -> lcur,scur | (entry, pos, last) :: rest -> let line_beg, _ = Line.of_pos pos in - let len = + let pos_cr = (try String.index_from fs line_beg '\n' - with Not_found -> String.length fs) - line_beg in + with Not_found -> String.length fs) in + let pos_lf = + (try String.index_from fs line_beg '\r' + with Not_found -> String.length fs) in + let len = (min pos_cr pos_lf) - line_beg in let fl, n = line filename entry (String.sub fs line_beg len) in loop (fl :: lcur) (n + scur) rest in