fix indents for child elements when using -1 (#2119)

This commit is contained in:
Ben Fry
2013-10-11 19:27:10 -04:00
parent 316a600a9d
commit c1b076ba07
3 changed files with 15 additions and 13 deletions

View File

@@ -1182,9 +1182,10 @@ public class JSONArray {
if (length == 1) {
JSONObject.writeValue(writer, this.myArrayList.get(0),
thisFactor, indent);
indentFactor, indent);
// thisFactor, indent);
} else if (length != 0) {
final int newindent = indent + thisFactor;
final int newIndent = indent + thisFactor;
for (int i = 0; i < length; i += 1) {
if (commanate) {
@@ -1193,9 +1194,11 @@ public class JSONArray {
if (indentFactor != -1) {
writer.write('\n');
}
JSONObject.indent(writer, newindent);
JSONObject.indent(writer, newIndent);
// JSONObject.writeValue(writer, this.myArrayList.get(i),
// thisFactor, newIndent);
JSONObject.writeValue(writer, this.myArrayList.get(i),
thisFactor, newindent);
indentFactor, newIndent);
commanate = true;
}
if (indentFactor != -1) {