datagram 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.env.sample +7 -0
- data/.gitignore +20 -0
- data/.rbenv-version +1 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +22 -0
- data/Procfile +1 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/config.ru +5 -0
- data/datagram.gemspec +23 -0
- data/db/migrate/1_create_queries.rb +9 -0
- data/db/migrate/2_add_name_to_queries.rb +5 -0
- data/lib/datagram/version.rb +3 -0
- data/lib/datagram.rb +135 -0
- data/lib/views/application.coffee +222 -0
- data/lib/views/index.haml +47 -0
- data/lib/views/layout.haml +17 -0
- data/lib/views/style.sass +179 -0
- data/public/ace/ace.js +15209 -0
- data/public/ace/ext-elastic_tabstops_lite.js +301 -0
- data/public/ace/ext-emmet.js +253 -0
- data/public/ace/ext-searchbox.js +441 -0
- data/public/ace/ext-spellcheck.js +67 -0
- data/public/ace/ext-static_highlight.js +96 -0
- data/public/ace/ext-textarea.js +492 -0
- data/public/ace/ext-whitespace.js +204 -0
- data/public/ace/keybinding-emacs.js +962 -0
- data/public/ace/keybinding-vim.js +1704 -0
- data/public/ace/mode-abap.js +260 -0
- data/public/ace/mode-asciidoc.js +372 -0
- data/public/ace/mode-c9search.js +182 -0
- data/public/ace/mode-c_cpp.js +737 -0
- data/public/ace/mode-clojure.js +299 -0
- data/public/ace/mode-coffee.js +426 -0
- data/public/ace/mode-coldfusion.js +1753 -0
- data/public/ace/mode-csharp.js +612 -0
- data/public/ace/mode-css.js +773 -0
- data/public/ace/mode-curly.js +1950 -0
- data/public/ace/mode-dart.js +945 -0
- data/public/ace/mode-diff.js +166 -0
- data/public/ace/mode-django.js +1969 -0
- data/public/ace/mode-dot.js +320 -0
- data/public/ace/mode-ftl.js +907 -0
- data/public/ace/mode-glsl.js +810 -0
- data/public/ace/mode-golang.js +632 -0
- data/public/ace/mode-groovy.js +1037 -0
- data/public/ace/mode-haml.js +487 -0
- data/public/ace/mode-haxe.js +609 -0
- data/public/ace/mode-html.js +1881 -0
- data/public/ace/mode-jade.js +1951 -0
- data/public/ace/mode-java.js +996 -0
- data/public/ace/mode-javascript.js +876 -0
- data/public/ace/mode-json.js +578 -0
- data/public/ace/mode-jsp.js +1351 -0
- data/public/ace/mode-jsx.js +635 -0
- data/public/ace/mode-latex.js +189 -0
- data/public/ace/mode-less.js +807 -0
- data/public/ace/mode-liquid.js +862 -0
- data/public/ace/mode-lisp.js +138 -0
- data/public/ace/mode-livescript.js +288 -0
- data/public/ace/mode-logiql.js +664 -0
- data/public/ace/mode-lsl.js +828 -0
- data/public/ace/mode-lua.js +455 -0
- data/public/ace/mode-luapage.js +2340 -0
- data/public/ace/mode-lucene.js +64 -0
- data/public/ace/mode-makefile.js +313 -0
- data/public/ace/mode-markdown.js +2280 -0
- data/public/ace/mode-mushcode.js +704 -0
- data/public/ace/mode-mushcode_high_rules.js +569 -0
- data/public/ace/mode-objectivec.js +659 -0
- data/public/ace/mode-ocaml.js +443 -0
- data/public/ace/mode-pascal.js +233 -0
- data/public/ace/mode-perl.js +316 -0
- data/public/ace/mode-pgsql.js +908 -0
- data/public/ace/mode-php.js +2291 -0
- data/public/ace/mode-powershell.js +618 -0
- data/public/ace/mode-python.js +264 -0
- data/public/ace/mode-r.js +404 -0
- data/public/ace/mode-rdoc.js +184 -0
- data/public/ace/mode-rhtml.js +2168 -0
- data/public/ace/mode-ruby.js +431 -0
- data/public/ace/mode-sass.js +442 -0
- data/public/ace/mode-scad.js +670 -0
- data/public/ace/mode-scala.js +1025 -0
- data/public/ace/mode-scheme.js +144 -0
- data/public/ace/mode-scss.js +832 -0
- data/public/ace/mode-sh.js +204 -0
- data/public/ace/mode-sql.js +118 -0
- data/public/ace/mode-stylus.js +483 -0
- data/public/ace/mode-svg.js +1442 -0
- data/public/ace/mode-tcl.js +319 -0
- data/public/ace/mode-tex.js +166 -0
- data/public/ace/mode-text.js +0 -0
- data/public/ace/mode-textile.js +170 -0
- data/public/ace/mode-tmsnippet.js +200 -0
- data/public/ace/mode-toml.js +180 -0
- data/public/ace/mode-typescript.js +961 -0
- data/public/ace/mode-vbscript.js +281 -0
- data/public/ace/mode-velocity.js +962 -0
- data/public/ace/mode-xml.js +789 -0
- data/public/ace/mode-xquery.js +2750 -0
- data/public/ace/mode-yaml.js +289 -0
- data/public/ace/theme-ambiance.js +202 -0
- data/public/ace/theme-chaos.js +182 -0
- data/public/ace/theme-chrome.js +161 -0
- data/public/ace/theme-clouds.js +135 -0
- data/public/ace/theme-clouds_midnight.js +136 -0
- data/public/ace/theme-cobalt.js +150 -0
- data/public/ace/theme-crimson_editor.js +154 -0
- data/public/ace/theme-dawn.js +146 -0
- data/public/ace/theme-dreamweaver.js +173 -0
- data/public/ace/theme-eclipse.js +122 -0
- data/public/ace/theme-github.js +136 -0
- data/public/ace/theme-idle_fingers.js +136 -0
- data/public/ace/theme-kr.js +143 -0
- data/public/ace/theme-merbivore.js +135 -0
- data/public/ace/theme-merbivore_soft.js +136 -0
- data/public/ace/theme-mono_industrial.js +148 -0
- data/public/ace/theme-monokai.js +140 -0
- data/public/ace/theme-pastel_on_dark.js +148 -0
- data/public/ace/theme-solarized_dark.js +128 -0
- data/public/ace/theme-solarized_light.js +131 -0
- data/public/ace/theme-terminal.js +154 -0
- data/public/ace/theme-textmate.js +0 -0
- data/public/ace/theme-tomorrow.js +147 -0
- data/public/ace/theme-tomorrow_night.js +147 -0
- data/public/ace/theme-tomorrow_night_blue.js +145 -0
- data/public/ace/theme-tomorrow_night_bright.js +147 -0
- data/public/ace/theme-tomorrow_night_eighties.js +144 -0
- data/public/ace/theme-twilight.js +147 -0
- data/public/ace/theme-vibrant_ink.js +131 -0
- data/public/ace/theme-xcode.js +125 -0
- data/public/ace/worker-coffee.js +7091 -0
- data/public/ace/worker-css.js +8289 -0
- data/public/ace/worker-javascript.js +6496 -0
- data/public/ace/worker-json.js +2305 -0
- data/public/ace/worker-lua.js +3313 -0
- data/public/ace/worker-php.js +6743 -0
- data/public/ace/worker-xquery.js +21897 -0
- data/public/font/FontAwesome.otf +0 -0
- data/public/font/fontawesome-webfont.eot +0 -0
- data/public/font/fontawesome-webfont.svg +284 -0
- data/public/font/fontawesome-webfont.ttf +0 -0
- data/public/font/fontawesome-webfont.woff +0 -0
- data/public/font-awesome.css +540 -0
- data/public/jquery.js +9597 -0
- data/script/migrate.sh +2 -0
- metadata +242 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
define('ace/mode/lucene', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/lucene_highlight_rules'], function(require, exports, module) {
|
2
|
+
|
3
|
+
|
4
|
+
var oop = require("../lib/oop");
|
5
|
+
var TextMode = require("./text").Mode;
|
6
|
+
var Tokenizer = require("../tokenizer").Tokenizer;
|
7
|
+
var LuceneHighlightRules = require("./lucene_highlight_rules").LuceneHighlightRules;
|
8
|
+
|
9
|
+
var Mode = function() {
|
10
|
+
this.$tokenizer = new Tokenizer(new LuceneHighlightRules().getRules());
|
11
|
+
};
|
12
|
+
|
13
|
+
oop.inherits(Mode, TextMode);
|
14
|
+
|
15
|
+
exports.Mode = Mode;
|
16
|
+
});define('ace/mode/lucene_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
17
|
+
|
18
|
+
|
19
|
+
var oop = require("../lib/oop");
|
20
|
+
var lang = require("../lib/lang");
|
21
|
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
22
|
+
|
23
|
+
var LuceneHighlightRules = function() {
|
24
|
+
this.$rules = {
|
25
|
+
"start" : [
|
26
|
+
{
|
27
|
+
token : "constant.character.negation",
|
28
|
+
regex : "[\\-]"
|
29
|
+
}, {
|
30
|
+
token : "constant.character.interro",
|
31
|
+
regex : "[\\?]"
|
32
|
+
}, {
|
33
|
+
token : "constant.character.asterisk",
|
34
|
+
regex : "[\\*]"
|
35
|
+
}, {
|
36
|
+
token: 'constant.character.proximity',
|
37
|
+
regex: '~[0-9]+\\b'
|
38
|
+
}, {
|
39
|
+
token : 'keyword.operator',
|
40
|
+
regex: '(?:AND|OR|NOT)\\b'
|
41
|
+
}, {
|
42
|
+
token : "paren.lparen",
|
43
|
+
regex : "[\\(]"
|
44
|
+
}, {
|
45
|
+
token : "paren.rparen",
|
46
|
+
regex : "[\\)]"
|
47
|
+
}, {
|
48
|
+
token : "keyword",
|
49
|
+
regex : "[\\S]+:"
|
50
|
+
}, {
|
51
|
+
token : "string", // " string
|
52
|
+
regex : '".*?"'
|
53
|
+
}, {
|
54
|
+
token : "text",
|
55
|
+
regex : "\\s+"
|
56
|
+
}
|
57
|
+
]
|
58
|
+
};
|
59
|
+
};
|
60
|
+
|
61
|
+
oop.inherits(LuceneHighlightRules, TextHighlightRules);
|
62
|
+
|
63
|
+
exports.LuceneHighlightRules = LuceneHighlightRules;
|
64
|
+
});
|
@@ -0,0 +1,313 @@
|
|
1
|
+
/* ***** BEGIN LICENSE BLOCK *****
|
2
|
+
* Distributed under the BSD license:
|
3
|
+
*
|
4
|
+
* Copyright (c) 2012, Ajax.org B.V.
|
5
|
+
* All rights reserved.
|
6
|
+
*
|
7
|
+
* Redistribution and use in source and binary forms, with or without
|
8
|
+
* modification, are permitted provided that the following conditions are met:
|
9
|
+
* * Redistributions of source code must retain the above copyright
|
10
|
+
* notice, this list of conditions and the following disclaimer.
|
11
|
+
* * Redistributions in binary form must reproduce the above copyright
|
12
|
+
* notice, this list of conditions and the following disclaimer in the
|
13
|
+
* documentation and/or other materials provided with the distribution.
|
14
|
+
* * Neither the name of Ajax.org B.V. nor the
|
15
|
+
* names of its contributors may be used to endorse or promote products
|
16
|
+
* derived from this software without specific prior written permission.
|
17
|
+
*
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
22
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
24
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
25
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
28
|
+
*
|
29
|
+
*
|
30
|
+
* Contributor(s):
|
31
|
+
*
|
32
|
+
*
|
33
|
+
*
|
34
|
+
* ***** END LICENSE BLOCK ***** */
|
35
|
+
|
36
|
+
define('ace/mode/makefile', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/makefile_highlight_rules', 'ace/mode/folding/coffee'], function(require, exports, module) {
|
37
|
+
|
38
|
+
|
39
|
+
var oop = require("../lib/oop");
|
40
|
+
var TextMode = require("./text").Mode;
|
41
|
+
var Tokenizer = require("../tokenizer").Tokenizer;
|
42
|
+
var MakefileHighlightRules = require("./makefile_highlight_rules").MakefileHighlightRules;
|
43
|
+
var FoldMode = require("./folding/coffee").FoldMode;
|
44
|
+
|
45
|
+
var Mode = function() {
|
46
|
+
var highlighter = new MakefileHighlightRules();
|
47
|
+
this.foldingRules = new FoldMode();
|
48
|
+
|
49
|
+
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
50
|
+
};
|
51
|
+
oop.inherits(Mode, TextMode);
|
52
|
+
|
53
|
+
(function() {
|
54
|
+
|
55
|
+
this.lineCommentStart = "#";
|
56
|
+
}).call(Mode.prototype);
|
57
|
+
|
58
|
+
exports.Mode = Mode;
|
59
|
+
});define('ace/mode/makefile_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules', 'ace/mode/sh_highlight_rules'], function(require, exports, module) {
|
60
|
+
|
61
|
+
|
62
|
+
var oop = require("../lib/oop");
|
63
|
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
64
|
+
|
65
|
+
var ShHighlightFile = require("./sh_highlight_rules");
|
66
|
+
|
67
|
+
var MakefileHighlightRules = function() {
|
68
|
+
|
69
|
+
var keywordMapper = this.createKeywordMapper({
|
70
|
+
"keyword": ShHighlightFile.reservedKeywords,
|
71
|
+
"support.function.builtin": ShHighlightFile.languageConstructs,
|
72
|
+
"invalid.deprecated": "debugger"
|
73
|
+
}, "string");
|
74
|
+
|
75
|
+
this.$rules =
|
76
|
+
{
|
77
|
+
"start": [
|
78
|
+
{
|
79
|
+
token: "string.interpolated.backtick.makefile",
|
80
|
+
regex: "`",
|
81
|
+
next: "shell-start"
|
82
|
+
},
|
83
|
+
{
|
84
|
+
token: "punctuation.definition.comment.makefile",
|
85
|
+
regex: /#(?=.)/,
|
86
|
+
next: "comment"
|
87
|
+
},
|
88
|
+
{
|
89
|
+
token: [ "keyword.control.makefile"],
|
90
|
+
regex: "^(?:\\s*\\b)(\\-??include|ifeq|ifneq|ifdef|ifndef|else|endif|vpath|export|unexport|define|endef|override)(?:\\b)"
|
91
|
+
},
|
92
|
+
{// ^([^\t ]+(\s[^\t ]+)*:(?!\=))\s*.*
|
93
|
+
token: ["entity.name.function.makefile", "text"],
|
94
|
+
regex: "^([^\\t ]+(?:\\s[^\\t ]+)*:)(\\s*.*)"
|
95
|
+
}
|
96
|
+
],
|
97
|
+
"comment": [
|
98
|
+
{
|
99
|
+
token : "punctuation.definition.comment.makefile",
|
100
|
+
regex : /.+\\/
|
101
|
+
},
|
102
|
+
{
|
103
|
+
token : "punctuation.definition.comment.makefile",
|
104
|
+
regex : ".+",
|
105
|
+
next : "start"
|
106
|
+
}
|
107
|
+
],
|
108
|
+
"shell-start": [
|
109
|
+
{
|
110
|
+
token: keywordMapper,
|
111
|
+
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
112
|
+
},
|
113
|
+
{
|
114
|
+
token: "string",
|
115
|
+
regex : "\\w+"
|
116
|
+
},
|
117
|
+
{
|
118
|
+
token : "string.interpolated.backtick.makefile",
|
119
|
+
regex : "`",
|
120
|
+
next : "start"
|
121
|
+
}
|
122
|
+
]
|
123
|
+
}
|
124
|
+
|
125
|
+
};
|
126
|
+
|
127
|
+
oop.inherits(MakefileHighlightRules, TextHighlightRules);
|
128
|
+
|
129
|
+
exports.MakefileHighlightRules = MakefileHighlightRules;
|
130
|
+
});
|
131
|
+
|
132
|
+
define('ace/mode/sh_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
133
|
+
|
134
|
+
|
135
|
+
var oop = require("../lib/oop");
|
136
|
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
137
|
+
|
138
|
+
var reservedKeywords = exports.reservedKeywords = (
|
139
|
+
'!|{|}|case|do|done|elif|else|'+
|
140
|
+
'esac|fi|for|if|in|then|until|while|'+
|
141
|
+
'&|;|export|local|read|typeset|unset|'+
|
142
|
+
'elif|select|set'
|
143
|
+
);
|
144
|
+
|
145
|
+
var languageConstructs = exports.languageConstructs = (
|
146
|
+
'[|]|alias|bg|bind|break|builtin|'+
|
147
|
+
'cd|command|compgen|complete|continue|'+
|
148
|
+
'dirs|disown|echo|enable|eval|exec|'+
|
149
|
+
'exit|fc|fg|getopts|hash|help|history|'+
|
150
|
+
'jobs|kill|let|logout|popd|printf|pushd|'+
|
151
|
+
'pwd|return|set|shift|shopt|source|'+
|
152
|
+
'suspend|test|times|trap|type|ulimit|'+
|
153
|
+
'umask|unalias|wait'
|
154
|
+
);
|
155
|
+
|
156
|
+
var ShHighlightRules = function() {
|
157
|
+
var keywordMapper = this.createKeywordMapper({
|
158
|
+
"keyword": reservedKeywords,
|
159
|
+
"support.function.builtin": languageConstructs,
|
160
|
+
"invalid.deprecated": "debugger"
|
161
|
+
}, "identifier");
|
162
|
+
|
163
|
+
var integer = "(?:(?:[1-9]\\d*)|(?:0))";
|
164
|
+
|
165
|
+
var fraction = "(?:\\.\\d+)";
|
166
|
+
var intPart = "(?:\\d+)";
|
167
|
+
var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
|
168
|
+
var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + ")";
|
169
|
+
var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
|
170
|
+
var fileDescriptor = "(?:&" + intPart + ")";
|
171
|
+
|
172
|
+
var variableName = "[a-zA-Z][a-zA-Z0-9_]*";
|
173
|
+
var variable = "(?:(?:\\$" + variableName + ")|(?:" + variableName + "=))";
|
174
|
+
|
175
|
+
var builtinVariable = "(?:\\$(?:SHLVL|\\$|\\!|\\?))";
|
176
|
+
|
177
|
+
var func = "(?:" + variableName + "\\s*\\(\\))";
|
178
|
+
|
179
|
+
this.$rules = {
|
180
|
+
"start" : [ {
|
181
|
+
token : ["text", "comment"],
|
182
|
+
regex : /(^|\s)(#.*)$/
|
183
|
+
}, {
|
184
|
+
token : "string", // " string
|
185
|
+
regex : '"(?:[^\\\\]|\\\\.)*?"'
|
186
|
+
}, {
|
187
|
+
token : "variable.language",
|
188
|
+
regex : builtinVariable
|
189
|
+
}, {
|
190
|
+
token : "variable",
|
191
|
+
regex : variable
|
192
|
+
}, {
|
193
|
+
token : "support.function",
|
194
|
+
regex : func
|
195
|
+
}, {
|
196
|
+
token : "support.function",
|
197
|
+
regex : fileDescriptor
|
198
|
+
}, {
|
199
|
+
token : "string", // ' string
|
200
|
+
regex : "'(?:[^\\\\]|\\\\.)*?'"
|
201
|
+
}, {
|
202
|
+
token : "constant.numeric", // float
|
203
|
+
regex : floatNumber
|
204
|
+
}, {
|
205
|
+
token : "constant.numeric", // integer
|
206
|
+
regex : integer + "\\b"
|
207
|
+
}, {
|
208
|
+
token : keywordMapper,
|
209
|
+
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
210
|
+
}, {
|
211
|
+
token : "keyword.operator",
|
212
|
+
regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!="
|
213
|
+
}, {
|
214
|
+
token : "paren.lparen",
|
215
|
+
regex : "[\\[\\(\\{]"
|
216
|
+
}, {
|
217
|
+
token : "paren.rparen",
|
218
|
+
regex : "[\\]\\)\\}]"
|
219
|
+
} ]
|
220
|
+
};
|
221
|
+
};
|
222
|
+
|
223
|
+
oop.inherits(ShHighlightRules, TextHighlightRules);
|
224
|
+
|
225
|
+
exports.ShHighlightRules = ShHighlightRules;
|
226
|
+
});
|
227
|
+
|
228
|
+
define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
|
229
|
+
|
230
|
+
|
231
|
+
var oop = require("../../lib/oop");
|
232
|
+
var BaseFoldMode = require("./fold_mode").FoldMode;
|
233
|
+
var Range = require("../../range").Range;
|
234
|
+
|
235
|
+
var FoldMode = exports.FoldMode = function() {};
|
236
|
+
oop.inherits(FoldMode, BaseFoldMode);
|
237
|
+
|
238
|
+
(function() {
|
239
|
+
|
240
|
+
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
241
|
+
var range = this.indentationBlock(session, row);
|
242
|
+
if (range)
|
243
|
+
return range;
|
244
|
+
|
245
|
+
var re = /\S/;
|
246
|
+
var line = session.getLine(row);
|
247
|
+
var startLevel = line.search(re);
|
248
|
+
if (startLevel == -1 || line[startLevel] != "#")
|
249
|
+
return;
|
250
|
+
|
251
|
+
var startColumn = line.length;
|
252
|
+
var maxRow = session.getLength();
|
253
|
+
var startRow = row;
|
254
|
+
var endRow = row;
|
255
|
+
|
256
|
+
while (++row < maxRow) {
|
257
|
+
line = session.getLine(row);
|
258
|
+
var level = line.search(re);
|
259
|
+
|
260
|
+
if (level == -1)
|
261
|
+
continue;
|
262
|
+
|
263
|
+
if (line[level] != "#")
|
264
|
+
break;
|
265
|
+
|
266
|
+
endRow = row;
|
267
|
+
}
|
268
|
+
|
269
|
+
if (endRow > startRow) {
|
270
|
+
var endColumn = session.getLine(endRow).length;
|
271
|
+
return new Range(startRow, startColumn, endRow, endColumn);
|
272
|
+
}
|
273
|
+
};
|
274
|
+
this.getFoldWidget = function(session, foldStyle, row) {
|
275
|
+
var line = session.getLine(row);
|
276
|
+
var indent = line.search(/\S/);
|
277
|
+
var next = session.getLine(row + 1);
|
278
|
+
var prev = session.getLine(row - 1);
|
279
|
+
var prevIndent = prev.search(/\S/);
|
280
|
+
var nextIndent = next.search(/\S/);
|
281
|
+
|
282
|
+
if (indent == -1) {
|
283
|
+
session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
|
284
|
+
return "";
|
285
|
+
}
|
286
|
+
if (prevIndent == -1) {
|
287
|
+
if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
|
288
|
+
session.foldWidgets[row - 1] = "";
|
289
|
+
session.foldWidgets[row + 1] = "";
|
290
|
+
return "start";
|
291
|
+
}
|
292
|
+
} else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
|
293
|
+
if (session.getLine(row - 2).search(/\S/) == -1) {
|
294
|
+
session.foldWidgets[row - 1] = "start";
|
295
|
+
session.foldWidgets[row + 1] = "";
|
296
|
+
return "";
|
297
|
+
}
|
298
|
+
}
|
299
|
+
|
300
|
+
if (prevIndent!= -1 && prevIndent < indent)
|
301
|
+
session.foldWidgets[row - 1] = "start";
|
302
|
+
else
|
303
|
+
session.foldWidgets[row - 1] = "";
|
304
|
+
|
305
|
+
if (indent < nextIndent)
|
306
|
+
return "start";
|
307
|
+
else
|
308
|
+
return "";
|
309
|
+
};
|
310
|
+
|
311
|
+
}).call(FoldMode.prototype);
|
312
|
+
|
313
|
+
});
|