|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2000-2014 JetBrains s.r.o. |
|
|
|
* Copyright 2000-2015 JetBrains s.r.o. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
@ -150,9 +150,12 @@ public class TextBuffer { |
|
|
|
while ((lineEnd = myStringBuilder.indexOf(myLineSeparator, lineStart)) > 0) { |
|
|
|
while ((lineEnd = myStringBuilder.indexOf(myLineSeparator, lineStart)) > 0) { |
|
|
|
++count; |
|
|
|
++count; |
|
|
|
sb.append(myStringBuilder.substring(lineStart, lineEnd)); |
|
|
|
sb.append(myStringBuilder.substring(lineStart, lineEnd)); |
|
|
|
Integer integer = myLineMapping.get(count); |
|
|
|
Set<Integer> integers = myLineMapping.get(count); |
|
|
|
if (integer != null) { |
|
|
|
if (integers != null) { |
|
|
|
sb.append("// ").append(integer); |
|
|
|
sb.append("//"); |
|
|
|
|
|
|
|
for (Integer integer : integers) { |
|
|
|
|
|
|
|
sb.append(' ').append(integer); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
sb.append(myLineSeparator); |
|
|
|
sb.append(myLineSeparator); |
|
|
|
lineStart = lineEnd + length; |
|
|
|
lineStart = lineEnd + length; |
|
|
@ -302,17 +305,18 @@ public class TextBuffer { |
|
|
|
return myStringBuilder; |
|
|
|
return myStringBuilder; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Map<Integer, Integer> myLineMapping = null; // new to original
|
|
|
|
private Map<Integer, Set<Integer>> myLineMapping = null; // new to original
|
|
|
|
public void dumpOriginalLineNumbers(int[] lineMapping) { |
|
|
|
public void dumpOriginalLineNumbers(int[] lineMapping) { |
|
|
|
if (lineMapping.length > 0) { |
|
|
|
if (lineMapping.length > 0) { |
|
|
|
myLineMapping = new HashMap<Integer, Integer>(); |
|
|
|
myLineMapping = new HashMap<Integer, Set<Integer>>(); |
|
|
|
for (int i = 0; i < lineMapping.length; i+=2) { |
|
|
|
for (int i = 0; i < lineMapping.length; i+=2) { |
|
|
|
int key = lineMapping[i + 1]; |
|
|
|
int key = lineMapping[i + 1]; |
|
|
|
int value = lineMapping[i]; |
|
|
|
Set<Integer> existing = myLineMapping.get(key); |
|
|
|
Integer existing = myLineMapping.get(key); |
|
|
|
if (existing == null) { |
|
|
|
if (existing == null || value < existing) { |
|
|
|
existing = new TreeSet<Integer>(); |
|
|
|
myLineMapping.put(key, value); |
|
|
|
myLineMapping.put(key, existing); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
existing.add(lineMapping[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|