| 220 | } |
| 221 | |
| 222 | public int indent() |
| 223 | throws IOException { |
| 224 | int n = 0; |
| 225 | for (String ind : indents) { |
| 226 | if ( ind!=null ) { |
| 227 | n += ind.length(); |
| 228 | out.write(ind); |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | // If current anchor is beyond current indent width, indent to anchor |
| 233 | // *after* doing indents (might tabs in there or whatever) |
| 234 | |
| 235 | int indentWidth = n; |
| 236 | if ( anchors_sp>=0 && anchors[anchors_sp]>indentWidth ) { |
| 237 | int remainder = anchors[anchors_sp]-indentWidth; |
| 238 | for (int i = 1; i<=remainder; i++) out.write(' '); |
| 239 | n += remainder; |
| 240 | } |
| 241 | charPosition += n; |
| 242 | charIndex += n; |
| 243 | return n; |
| 244 | } |
| 245 | } |