<div dir="ltr">No, I don't. I actually don't think we properly support "\r\n" at all. I'll investigate.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 2, 2013 at 5:20 PM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks!<div><br>Do you happen to know if this does the right thing for windows-style line endings (\r\n) too? Maybe clang-format doesn't format the next line if the last char covered by offset is \r?</div>
</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 2, 2013 at 6:20 AM, Daniel Jasper <span dir="ltr"><<a href="mailto:djasper@google.com" target="_blank">djasper@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: djasper<br>
Date: Tue Jul 2 08:20:35 2013<br>
New Revision: 185423<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=185423&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=185423&view=rev</a><br>
Log:<br>
Fix ranges computed by git clang-format.<br>
<br>
Before, the computed byte range would include the trailing newline.<br>
clang-format on the other hand counts whitespace as belonging to the<br>
following token, so that git-clang-format inadvertendly reformats the<br>
first unmodified line as well.<br>
<br>
It is not entirely clear whether clang-format's behavior itself should<br>
be modified, but for now this seems to be a safe change.<br>
<br>
Modified:<br>
cfe/trunk/tools/clang-format/git-clang-format<br>
<br>
Modified: cfe/trunk/tools/clang-format/git-clang-format<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/git-clang-format?rev=185423&r1=185422&r2=185423&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/git-clang-format?rev=185423&r1=185422&r2=185423&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/tools/clang-format/git-clang-format (original)<br>
+++ cfe/trunk/tools/clang-format/git-clang-format Tue Jul 2 08:20:35 2013<br>
@@ -329,13 +329,13 @@ def lines_to_bytes_single_file(file, lin<br>
if linenum == r.start:<br>
byte_start = byte_idx<br>
if linenum == r.start + r.count:<br>
- byte_ranges.append(Range(byte_start, byte_idx - byte_start))<br>
+ byte_ranges.append(Range(byte_start, byte_idx - byte_start - 1))<br>
r = next(line_ranges_iter)<br>
linenum += 1<br>
byte_idx += len(line)<br>
if r is not None:<br>
# FIXME: Detect and warn if line ranges go past the end of file?<br>
- byte_ranges.append(Range(byte_start, byte_idx - byte_start))<br>
+ byte_ranges.append(Range(byte_start, byte_idx - byte_start - 1))<br>
return byte_ranges<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>