From c6768c396c7f8768b48df5e5cc799db4a23701a3 Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Mon, 20 Mar 2017 19:47:11 +0000 Subject: [PATCH] Don't emit \r in the debugger --- debugger/show_source.ml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/debugger/show_source.ml b/debugger/show_source.ml index ac478717e..357132da7 100644 --- a/debugger/show_source.ml +++ b/debugger/show_source.ml @@ -23,18 +23,23 @@ open Source (* Print a line; return the beginning of the next line *) let print_line buffer line_number start point before = - let next = next_linefeed buffer start + let linefeed = next_linefeed buffer start and content = buffer_content buffer in printf "%i " line_number; - if point <= next && point >= start then + let line_end = + if linefeed > 0 && content.[linefeed - 1] = '\r' then + linefeed - 1 + else + linefeed in + if point <= line_end && point >= start then (print_string (String.sub content start (point - start)); print_string (if before then event_mark_before else event_mark_after); - print_string (String.sub content point (next - point))) + print_string (String.sub content point (line_end - point))) else - print_string (String.sub content start (next - start)); + print_string (String.sub content start (line_end - start)); print_newline (); - next + linefeed (* Tell Emacs we are nowhere in the source. *) let show_no_point () =