@@ -1249,12 +1249,13 @@ var Mode = function(name, caption, extensions) {
1249
1249
this . caption = caption ;
1250
1250
this . mode = "ace/mode/" + name ;
1251
1251
this . extensions = extensions ;
1252
+ var re ;
1252
1253
if ( / \^ / . test ( extensions ) ) {
1253
- var re = extensions . replace ( / \| ( \^ ) ? / g, function ( a , b ) {
1254
+ re = extensions . replace ( / \| ( \^ ) ? / g, function ( a , b ) {
1254
1255
return "$|" + ( b ? "^" : "^.*\\." ) ;
1255
1256
} ) + "$" ;
1256
1257
} else {
1257
- var re = "^.*\\.(" + extensions + ")$" ;
1258
+ re = "^.*\\.(" + extensions + ")$" ;
1258
1259
}
1259
1260
1260
1261
this . extRe = new RegExp ( re , "gi" ) ;
@@ -1301,15 +1302,16 @@ var supportedModes = {
1301
1302
Gherkin : [ "feature" ] ,
1302
1303
Gitignore : [ "^.gitignore" ] ,
1303
1304
Glsl : [ "glsl|frag|vert" ] ,
1305
+ Gobstones : [ "gbs" ] ,
1304
1306
golang : [ "go" ] ,
1305
1307
Groovy : [ "groovy" ] ,
1306
1308
HAML : [ "haml" ] ,
1307
1309
Handlebars : [ "hbs|handlebars|tpl|mustache" ] ,
1308
1310
Haskell : [ "hs" ] ,
1309
1311
haXe : [ "hx" ] ,
1310
1312
HTML : [ "html|htm|xhtml" ] ,
1311
- HTML_Ruby : [ "erb|rhtml|html.erb" ] ,
1312
1313
HTML_Elixir : [ "eex|html.eex" ] ,
1314
+ HTML_Ruby : [ "erb|rhtml|html.erb" ] ,
1313
1315
INI : [ "ini|conf|cfg|prefs" ] ,
1314
1316
Io : [ "io" ] ,
1315
1317
Jack : [ "jack" ] ,
@@ -1341,21 +1343,24 @@ var supportedModes = {
1341
1343
MUSHCode : [ "mc|mush" ] ,
1342
1344
MySQL : [ "mysql" ] ,
1343
1345
Nix : [ "nix" ] ,
1346
+ NSIS : [ "nsi|nsh" ] ,
1344
1347
ObjectiveC : [ "m|mm" ] ,
1345
1348
OCaml : [ "ml|mli" ] ,
1346
1349
Pascal : [ "pas|p" ] ,
1347
1350
Perl : [ "pl|pm" ] ,
1348
1351
pgSQL : [ "pgsql" ] ,
1349
- PHP : [ "php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp" ] ,
1352
+ PHP : [ "php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module " ] ,
1350
1353
Powershell : [ "ps1" ] ,
1351
1354
Praat : [ "praat|praatscript|psc|proc" ] ,
1352
1355
Prolog : [ "plg|prolog" ] ,
1353
1356
Properties : [ "properties" ] ,
1354
1357
Protobuf : [ "proto" ] ,
1355
1358
Python : [ "py" ] ,
1356
1359
R : [ "r" ] ,
1360
+ Razor : [ "cshtml" ] ,
1357
1361
RDoc : [ "Rd" ] ,
1358
1362
RHTML : [ "Rhtml" ] ,
1363
+ RST : [ "rst" ] ,
1359
1364
Ruby : [ "rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile" ] ,
1360
1365
Rust : [ "rs" ] ,
1361
1366
SASS : [ "sass" ] ,
@@ -1386,6 +1391,7 @@ var supportedModes = {
1386
1391
Velocity : [ "vm" ] ,
1387
1392
Verilog : [ "v|vh|sv|svh" ] ,
1388
1393
VHDL : [ "vhd|vhdl" ] ,
1394
+ Wollok : [ "wlk|wpgm|wtest" ] ,
1389
1395
XML : [ "xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml" ] ,
1390
1396
XQuery : [ "xq" ] ,
1391
1397
YAML : [ "yaml|yml" ] ,
@@ -1950,7 +1956,7 @@ module.exports = {
1950
1956
hugeDocs : prepareDocList ( hugeDocs ) ,
1951
1957
initDoc : initDoc ,
1952
1958
loadDoc : loadDoc ,
1953
- saveDoc : saveDoc ,
1959
+ saveDoc : saveDoc
1954
1960
} ;
1955
1961
module . exports . all = {
1956
1962
"Mode Examples" : module . exports . docs ,
@@ -2283,6 +2289,15 @@ var Renderer = require("ace/virtual_renderer").VirtualRenderer;
2283
2289
var Editor = require ( "ace/editor" ) . Editor ;
2284
2290
var MultiSelect = require ( "ace/multi_select" ) . MultiSelect ;
2285
2291
2292
+ var urlOptions = { }
2293
+ try {
2294
+ window . location . search . slice ( 1 ) . split ( / [ & ] / ) . forEach ( function ( e ) {
2295
+ var parts = e . split ( "=" ) ;
2296
+ urlOptions [ decodeURIComponent ( parts [ 0 ] ) ] = decodeURIComponent ( parts [ 1 ] ) ;
2297
+ } ) ;
2298
+ } catch ( e ) {
2299
+ console . error ( e ) ;
2300
+ }
2286
2301
exports . createEditor = function ( el ) {
2287
2302
return new Editor ( new Renderer ( el ) ) ;
2288
2303
} ;
@@ -2398,7 +2413,10 @@ exports.bindCheckbox = function(id, callback, noInit) {
2398
2413
id = el . id ;
2399
2414
}
2400
2415
var el = document . getElementById ( id ) ;
2401
- if ( localStorage && localStorage . getItem ( id ) )
2416
+
2417
+ if ( urlOptions [ id ] )
2418
+ el . checked = urlOptions [ id ] == "1" ;
2419
+ else if ( localStorage && localStorage . getItem ( id ) )
2402
2420
el . checked = localStorage . getItem ( id ) == "1" ;
2403
2421
2404
2422
var onCheck = function ( ) {
@@ -2417,7 +2435,10 @@ exports.bindDropdown = function(id, callback, noInit) {
2417
2435
var el = id ;
2418
2436
id = el . id ;
2419
2437
}
2420
- if ( localStorage && localStorage . getItem ( id ) )
2438
+
2439
+ if ( urlOptions [ id ] )
2440
+ el . value = urlOptions [ id ] ;
2441
+ else if ( localStorage && localStorage . getItem ( id ) )
2421
2442
el . value = localStorage . getItem ( id ) ;
2422
2443
2423
2444
var onChange = function ( ) {
@@ -2897,7 +2918,7 @@ function OccurKeyboardHandler() {}
2897
2918
2898
2919
oop . inherits ( OccurKeyboardHandler , HashHandler ) ;
2899
2920
2900
- ; ( function ( ) {
2921
+ ( function ( ) {
2901
2922
2902
2923
this . isOccurHandler = true ;
2903
2924
@@ -3152,7 +3173,7 @@ function objectToRegExp(obj) {
3152
3173
return stringToRegExp ( obj . expression , obj . flags ) ;
3153
3174
}
3154
3175
3155
- ; ( function ( ) {
3176
+ ( function ( ) {
3156
3177
3157
3178
this . activate = function ( ed , backwards ) {
3158
3179
this . $editor = ed ;
@@ -3647,7 +3668,7 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve
3647
3668
CodeMirror . commands = {
3648
3669
redo : function ( cm ) { cm . ace . redo ( ) ; } ,
3649
3670
undo : function ( cm ) { cm . ace . undo ( ) ; } ,
3650
- newlineAndIndent : function ( cm ) { cm . ace . insert ( "\n" ) ; } ,
3671
+ newlineAndIndent : function ( cm ) { cm . ace . insert ( "\n" ) ; }
3651
3672
} ;
3652
3673
CodeMirror . keyMap = { } ;
3653
3674
CodeMirror . addClass = CodeMirror . rmClass =
@@ -4626,10 +4647,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
4626
4647
if ( key . charAt ( 0 ) == '\'' ) {
4627
4648
return key . charAt ( 1 ) ;
4628
4649
}
4629
- var pieces = key . split ( '-' ) ;
4630
- if ( / - $ / . test ( key ) ) {
4631
- pieces . splice ( - 2 , 2 , '-' ) ;
4632
- }
4650
+ var pieces = key . split ( / - (? ! $ ) / ) ;
4633
4651
var lastPiece = pieces [ pieces . length - 1 ] ;
4634
4652
if ( pieces . length == 1 && pieces [ 0 ] . length == 1 ) {
4635
4653
return false ;
@@ -5053,7 +5071,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
5053
5071
}
5054
5072
5055
5073
function handleKeyNonInsertMode ( ) {
5056
- if ( handleMacroRecording ( ) || handleEsc ( ) ) { return true ; } ;
5074
+ if ( handleMacroRecording ( ) || handleEsc ( ) ) { return true ; }
5057
5075
5058
5076
var keys = vim . inputState . keyBuffer = vim . inputState . keyBuffer + key ;
5059
5077
if ( / ^ [ 1 - 9 ] \d * $ / . test ( keys ) ) { return true ; }
@@ -5613,7 +5631,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
5613
5631
return ;
5614
5632
}
5615
5633
if ( motionArgs . toJumplist ) {
5616
- if ( ! operator )
5634
+ if ( ! operator && cm . ace . curOp != null )
5617
5635
cm . ace . curOp . command . scrollIntoView = "center-animate" ; // ace_patch
5618
5636
var jumpList = vimGlobalState . jumpList ;
5619
5637
var cachedCursor = jumpList . cachedCursor ;
@@ -6104,11 +6122,19 @@ dom.importCssString(".normal-mode .ace_cursor{\
6104
6122
text = text . slice ( 0 , - match [ 0 ] . length ) ;
6105
6123
}
6106
6124
}
6107
- var wasLastLine = head . line - 1 == cm . lastLine ( ) ;
6108
- cm . replaceRange ( '' , anchor , head ) ;
6109
- if ( args . linewise && ! wasLastLine ) {
6110
- CodeMirror . commands . newlineAndIndent ( cm ) ;
6111
- anchor . ch = null ;
6125
+ var prevLineEnd = new Pos ( anchor . line - 1 , Number . MAX_VALUE ) ;
6126
+ var wasLastLine = cm . firstLine ( ) == cm . lastLine ( ) ;
6127
+ if ( head . line > cm . lastLine ( ) && args . linewise && ! wasLastLine ) {
6128
+ cm . replaceRange ( '' , prevLineEnd , head ) ;
6129
+ } else {
6130
+ cm . replaceRange ( '' , anchor , head ) ;
6131
+ }
6132
+ if ( args . linewise ) {
6133
+ if ( ! wasLastLine ) {
6134
+ cm . setCursor ( prevLineEnd ) ;
6135
+ CodeMirror . commands . newlineAndIndent ( cm ) ;
6136
+ }
6137
+ anchor . ch = Number . MAX_VALUE ;
6112
6138
}
6113
6139
finalHead = anchor ;
6114
6140
} else {
@@ -8204,7 +8230,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
8204
8230
if ( decimal + hex + octal > 1 ) { return 'Invalid arguments' ; }
8205
8231
number = decimal && 'decimal' || hex && 'hex' || octal && 'octal' ;
8206
8232
}
8207
- if ( args . eatSpace ( ) && args . match ( / \/ .* \/ / ) ) { 'patterns not supported' ; }
8233
+ if ( args . match ( / \/ .* \/ / ) ) { return 'patterns not supported' ; }
8208
8234
}
8209
8235
}
8210
8236
var err = parseArgs ( ) ;
@@ -8520,7 +8546,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
8520
8546
}
8521
8547
if ( ! confirm ) {
8522
8548
replaceAll ( ) ;
8523
- if ( callback ) { callback ( ) ; } ;
8549
+ if ( callback ) { callback ( ) ; }
8524
8550
return ;
8525
8551
}
8526
8552
showPrompt ( cm , {
@@ -8642,7 +8668,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
8642
8668
exitInsertMode ( cm ) ;
8643
8669
}
8644
8670
}
8645
- } ;
8671
+ }
8646
8672
macroModeState . isPlaying = false ;
8647
8673
}
8648
8674
@@ -8791,7 +8817,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
8791
8817
exitInsertMode ( cm ) ;
8792
8818
}
8793
8819
macroModeState . isPlaying = false ;
8794
- } ;
8820
+ }
8795
8821
8796
8822
function repeatInsertModeChanges ( cm , changes , repeat ) {
8797
8823
function keyHandler ( binding ) {
@@ -9120,7 +9146,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
9120
9146
defaultKeymap . push (
9121
9147
{ keys : 'zc' , type : 'action' , action : 'fold' , actionArgs : { open : false } } ,
9122
9148
{ keys : 'zC' , type : 'action' , action : 'fold' , actionArgs : { open : false , all : true } } ,
9123
- { keys : 'zo' , type : 'action' , action : 'fold' , actionArgs : { open : true , } } ,
9149
+ { keys : 'zo' , type : 'action' , action : 'fold' , actionArgs : { open : true } } ,
9124
9150
{ keys : 'zO' , type : 'action' , action : 'fold' , actionArgs : { open : true , all : true } } ,
9125
9151
{ keys : 'za' , type : 'action' , action : 'fold' , actionArgs : { toggle : true } } ,
9126
9152
{ keys : 'zA' , type : 'action' , action : 'fold' , actionArgs : { toggle : true , all : true } } ,
@@ -9154,7 +9180,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
9154
9180
actions . fold = function ( cm , actionArgs , vim ) {
9155
9181
cm . ace . execCommand ( [ 'toggleFoldWidget' , 'toggleFoldWidget' , 'foldOther' , 'unfoldall'
9156
9182
] [ ( actionArgs . all ? 2 : 0 ) + ( actionArgs . open ? 1 : 0 ) ] ) ;
9157
- } ,
9183
+ } ;
9158
9184
9159
9185
exports . handler . defaultKeymap = defaultKeymap ;
9160
9186
exports . handler . actions = actions ;
@@ -10323,6 +10349,10 @@ exports.runEmmetCommand = function runEmmetCommand(editor) {
10323
10349
if ( this . action == "expand_abbreviation_with_tab" ) {
10324
10350
if ( ! editor . selection . isEmpty ( ) )
10325
10351
return false ;
10352
+ var pos = editor . selection . lead ;
10353
+ var token = editor . session . getTokenAt ( pos . row , pos . column ) ;
10354
+ if ( token && / \b t a g \b / . test ( token . type ) )
10355
+ return false ;
10326
10356
}
10327
10357
10328
10358
if ( this . action == "wrap_with_abbreviation" ) {
@@ -10331,11 +10361,6 @@ exports.runEmmetCommand = function runEmmetCommand(editor) {
10331
10361
} , 0 ) ;
10332
10362
}
10333
10363
10334
- var pos = editor . selection . lead ;
10335
- var token = editor . session . getTokenAt ( pos . row , pos . column ) ;
10336
- if ( token && / \b t a g \b / . test ( token . type ) )
10337
- return false ;
10338
-
10339
10364
var result = actions . run ( this . action , editorProxy ) ;
10340
10365
} catch ( e ) {
10341
10366
if ( ! emmet ) {
@@ -10629,7 +10654,7 @@ var AcePopup = function(parentNode) {
10629
10654
return selectionMarker . start . row ;
10630
10655
} ;
10631
10656
popup . setRow = function ( line ) {
10632
- line = Math . max ( - 1 , Math . min ( this . data . length , line ) ) ;
10657
+ line = Math . max ( 0 , Math . min ( this . data . length , line ) ) ;
10633
10658
if ( selectionMarker . start . row != line ) {
10634
10659
popup . selection . clearSelection ( ) ;
10635
10660
selectionMarker . start . row = selectionMarker . end . row = line || 0 ;
@@ -10782,6 +10807,21 @@ exports.retrieveFollowingIdentifier = function(text, pos, regex) {
10782
10807
return buf ;
10783
10808
} ;
10784
10809
10810
+ exports . getCompletionPrefix = function ( editor ) {
10811
+ var pos = editor . getCursorPosition ( ) ;
10812
+ var line = editor . session . getLine ( pos . row ) ;
10813
+ var prefix ;
10814
+ editor . completers . forEach ( function ( completer ) {
10815
+ if ( completer . identifierRegexps ) {
10816
+ completer . identifierRegexps . forEach ( function ( identifierRegex ) {
10817
+ if ( ! prefix && identifierRegex )
10818
+ prefix = this . retrievePrecedingIdentifier ( line , pos . column , identifierRegex ) ;
10819
+ } . bind ( this ) ) ;
10820
+ }
10821
+ } . bind ( this ) ) ;
10822
+ return prefix || this . retrievePrecedingIdentifier ( line , pos . column ) ;
10823
+ } ;
10824
+
10785
10825
} ) ;
10786
10826
10787
10827
define ( "ace/autocomplete" , [ "require" , "exports" , "module" , "ace/keyboard/hash_handler" , "ace/autocomplete/popup" , "ace/autocomplete/util" , "ace/lib/event" , "ace/lib/lang" , "ace/lib/dom" , "ace/snippets" ] , function ( require , exports , module ) {
@@ -10979,7 +11019,7 @@ var Autocomplete = function() {
10979
11019
var pos = editor . getCursorPosition ( ) ;
10980
11020
10981
11021
var line = session . getLine ( pos . row ) ;
10982
- var prefix = util . retrievePrecedingIdentifier ( line , pos . column ) ;
11022
+ var prefix = util . getCompletionPrefix ( editor ) ;
10983
11023
10984
11024
this . base = session . doc . createAnchor ( pos . row , pos . column - prefix . length ) ;
10985
11025
this . base . $insertRight = true ;
@@ -10988,12 +11028,12 @@ var Autocomplete = function() {
10988
11028
var total = editor . completers . length ;
10989
11029
editor . completers . forEach ( function ( completer , i ) {
10990
11030
completer . getCompletions ( editor , session , pos , prefix , function ( err , results ) {
10991
- if ( ! err )
11031
+ if ( ! err && results )
10992
11032
matches = matches . concat ( results ) ;
10993
11033
var pos = editor . getCursorPosition ( ) ;
10994
11034
var line = session . getLine ( pos . row ) ;
10995
11035
callback ( null , {
10996
- prefix : util . retrievePrecedingIdentifier ( line , pos . column , results [ 0 ] && results [ 0 ] . identifierRegex ) ,
11036
+ prefix : prefix ,
10997
11037
matches : matches ,
10998
11038
finished : ( -- total === 0 )
10999
11039
} ) ;
@@ -11330,7 +11370,8 @@ var snippetCompleter = {
11330
11370
11331
11371
var completers = [ snippetCompleter , textCompleter , keyWordCompleter ] ;
11332
11372
exports . setCompleters = function ( val ) {
11333
- completers = val || [ ] ;
11373
+ completers . length = 0 ;
11374
+ if ( val ) completers . push . apply ( completers , val ) ;
11334
11375
} ;
11335
11376
exports . addCompleter = function ( completer ) {
11336
11377
completers . push ( completer ) ;
@@ -11381,30 +11422,15 @@ var loadSnippetFile = function(id) {
11381
11422
} ) ;
11382
11423
} ;
11383
11424
11384
- function getCompletionPrefix ( editor ) {
11385
- var pos = editor . getCursorPosition ( ) ;
11386
- var line = editor . session . getLine ( pos . row ) ;
11387
- var prefix ;
11388
- editor . completers . forEach ( function ( completer ) {
11389
- if ( completer . identifierRegexps ) {
11390
- completer . identifierRegexps . forEach ( function ( identifierRegex ) {
11391
- if ( ! prefix && identifierRegex )
11392
- prefix = util . retrievePrecedingIdentifier ( line , pos . column , identifierRegex ) ;
11393
- } ) ;
11394
- }
11395
- } ) ;
11396
- return prefix || util . retrievePrecedingIdentifier ( line , pos . column ) ;
11397
- }
11398
-
11399
11425
var doLiveAutocomplete = function ( e ) {
11400
11426
var editor = e . editor ;
11401
11427
var hasCompleter = editor . completer && editor . completer . activated ;
11402
11428
if ( e . command . name === "backspace" ) {
11403
- if ( hasCompleter && ! getCompletionPrefix ( editor ) )
11429
+ if ( hasCompleter && ! util . getCompletionPrefix ( editor ) )
11404
11430
editor . completer . detach ( ) ;
11405
11431
}
11406
11432
else if ( e . command . name === "insertstring" ) {
11407
- var prefix = getCompletionPrefix ( editor ) ;
11433
+ var prefix = util . getCompletionPrefix ( editor ) ;
11408
11434
if ( prefix && ! hasCompleter ) {
11409
11435
if ( ! editor . completer ) {
11410
11436
editor . completer = new Autocomplete ( ) ;
@@ -12118,7 +12144,7 @@ function updateUIEditorOptions() {
12118
12144
themelist . themes . forEach ( function ( x ) { x . value = x . theme } ) ;
12119
12145
fillDropdown ( themeEl , {
12120
12146
Bright : themelist . themes . filter ( function ( x ) { return ! x . isDark } ) ,
12121
- Dark : themelist . themes . filter ( function ( x ) { return x . isDark } ) ,
12147
+ Dark : themelist . themes . filter ( function ( x ) { return x . isDark } )
12122
12148
} ) ;
12123
12149
12124
12150
event . addListener ( themeEl , "mouseover" , function ( e ) {
0 commit comments