(CodeBuffTokenStream tokens, int i)
| 263 | } |
| 264 | |
| 265 | public static int getInjectWSCategory(CodeBuffTokenStream tokens, int i) { |
| 266 | int precedingNL = getPrecedingNL(tokens, i); // how many lines to inject |
| 267 | |
| 268 | Token curToken = tokens.get(i); |
| 269 | Token prevToken = tokens.getPreviousRealToken(i); |
| 270 | |
| 271 | int ws = 0; |
| 272 | if ( precedingNL==0 ) { |
| 273 | ws = curToken.getCharPositionInLine() - |
| 274 | (prevToken.getCharPositionInLine()+prevToken.getText().length()); |
| 275 | } |
| 276 | |
| 277 | int injectNL_WS = CAT_NO_WS; |
| 278 | if ( precedingNL>0 ) { |
| 279 | injectNL_WS = nlcat(precedingNL); |
| 280 | } |
| 281 | else if ( ws>0 ) { |
| 282 | injectNL_WS = wscat(ws); |
| 283 | } |
| 284 | |
| 285 | return injectNL_WS; |
| 286 | } |
| 287 | |
| 288 | // at a newline, are we aligned with a prior sibling (in a list) etc... |
| 289 | public static int getAlignmentCategory(InputDocument doc, TerminalNode node, int indentSize) { |
no test coverage detected