| 85 | |
| 86 | CodeMirror.registerHelper("fold", "include", function(cm, start) { |
| 87 | function hasInclude(line) { |
| 88 | if (line < cm.firstLine() || line > cm.lastLine()) return null; |
| 89 | var start = cm.getTokenAt(CodeMirror.Pos(line, 1)); |
| 90 | if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1)); |
| 91 | if (start.type == "meta" && start.string.slice(0, 8) == "#include") return start.start + 8; |
| 92 | } |
| 93 | |
| 94 | var start = start.line, has = hasInclude(start); |
| 95 | if (has == null || hasInclude(start - 1) != null) return null; |