Permalink
...
Comparing changes
Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .
Open a pull request
Create a new pull request by comparing changes across two branches. If you need to, you can also .
Choose a Base Repository
codemirror/CodeMirror
Benvie/CodeMirror
BrendonSled/CodeMirror2
Brijen/CodeMirror2
CodePen/CodeMirrorEditor
DarioGT/CodeMirror2
GerHobbelt/CodeMirror2
GordonSmith/CodeMirror2
Gozala/CodeMirror
Kodowa/CodeMirror
MariusKarthaus/CodeMirror2
MichaelaIvanova/CodeMirror
NV/CodeMirror
Naatan/CodeMirror2
Nahrae/CodeMirror
Necrathex/CodeMirror2
NikhilS/CodeMirror2
Page-/CodeMirror2
ProPuke/CodeMirror2
Raynes/CodeMirror2
SimonWaldherrArchive/CodeMirror2
Suor/CodeMirror2
TheColorRed/CodeMirror2
TypedLambda/CodeMirror2
Visheshk/CodeMirror2
WebKutir/CodeMirror2
WolfgangKluge/CodeMirror2
achicu/CodeMirror2
adam-singer/CodeMirror2
adanlobato/CodeMirror2
adobe/CodeMirror2
aklaswad/CodeMirror2
alexey-k/CodeMirror2
amphro/CodeMirror2
ananyasen/CodeMirror2
andrecharland/CodeMirror2
ankit/CodeMirror2
areos/CodeMirror2
atul-bhouraskar/CodeMirror2
axtro/CodeMirror2
ayachi/CodeMirror2
benbunk/CodeMirror2
bengillies/CodeMirror2
billortell/CodeMirror2
blackvladimir/CodeMirror2
bnowel/CodeMirror2
borawjm/CodeMirror2
botelho/CodeMirror
bridger/CodeMirror2
bsletten/CodeMirror2
capacman/CodeMirror2
captn3m0/CodeMirror2
cethap/CodeMirror2
charles-cai/CodeMirror2
charlieroberts/CodeMirror2
chendeng/CodeMirror2
chris-morgan/CodeMirror2
cicloid/CodeMirror2
ciptard/CodeMirror2
clarkbox/CodeMirror2
clemos/CodeMirror2
cliffkoh/CodeMirror2
cloudgiant/CodeMirror2
codio/CodeMirror
contributed/CodeMirror2
dbja/CodeMirror2
deebugger/CodeMirror2
djiang/CodeMirror2
dparnell/CodeMirror2
durdn/CodeMirror2
dxw/CodeMirror2
dynosmurf/CodeMirror2
dyoo/CodeMirror2
ekhaled/CodeMirror2
espadrine/CodeMirror
est/CodeMirror2
existdissolve/CodeMirror2
fbuchinger/CodeMirror2
felmoon/CodeMirror2
femhub/CodeMirror2
flyabroad/CodeMirror2
fourchette/CodeMirror2
fpo123/CodeMirror2
fprochazka/CodeMirror2
frawa/TestCodeMirror2
fzzr-/CodeMirror2
galambalazs/CodeMirror2
gavriguy/CodeMirror2
greengiant/CodeMirror2
gzdw/CodeMirror2
hans/CodeMirror2
hanxianlong/CodeMirror2
ibdknox/CodeMirror
idflood/CodeMirror2
iee/CodeMirror2
infinnity/CodeMirror2
ingrid/CodeMirror2
j6mes/CodeMirror2
jankeromnes/CodeMirror
jasondavis/CodeMirror2
jbrinkman/CodeMirror2
jem/CodeMirror2
jenlure/CodeMirror2
jimmyoneill/CodeMirror2
jmwong/CodeMirror2
jongalloway/CodeMirror2
jots/CodeMirror2
joycse06/CodeMirror2
jurisv/CodeMirror2
kaniga/CodeMirror2
kasei/CodeMirror2
kjetilk/CodeMirror2
koide/CodeMirror2
koops/CodeMirror2
krockot/CodeMirror2
larscwallin/CodeMirror2
leafo/CodeMirror2
lgastako/CodeMirror2
lm/CodeMirror2
lopuhin/CodeMirror2
luojun/CodeMirror2
maks/CodeMirror2
mamboer/CodeMirror2
manyanlong/CodeMirror2
martn/CodeMirror2
massemanet/CodeMirror
maxkirsch/CodeMirror2
mb-crt/CodeMirror2
mbarkhau/CodeMirror2
mbrevoort/CodeMirror2-xquery
mcelrath/CodeMirror2
metzen/CodeMirror2
michalliu/CodeMirror2
michelemostarda/CodeMirror2
mimecuvalo/CodeMirror2
misfo/CodeMirror2
moon2l/CodeMirror2
movabletype/CodeMirror2
mozes/CodeMirror2
mwmessin/CodeMirror2
mwpark/CodeMirror2
mylittletools/CodeMirror2
mzero/CodeMirror2
nathansobo/CodeMirror2
nazriel/CodeMirror2
ndebeiss/CodeMirror2
nguillaumin/CodeMirror2
nitrous-io-zz/CodeMirror
njx/CodeMirror
nlwillia/CodeMirror2
nvdnkpr/CodeMirror2
onkis/CodeMirror2
oozou/CodeMirror2
openube/CodeMirror2
oxling/CodeMirror2
panchalmukundak/CodeMirror2
pavelfeldman/CodeMirror
peteguhl/CodeMirror2
peterarmstrong/CodeMirror2
peterkroon/CodeMirror2
pombredanne/CodeMirror2
pplaquette/CodeMirror2
purplecabbage/CodeMirror2
rascalmicro/CodeMirror2
rduenasf/CodeMirror2
robermorales/CodeMirror2
robhawkes/CodeMirror2
samuela/CodeMirror2
satchit/CodeMirror2
seanmcgary/CodeMirror2
siefkenj/CodeMirror2
simoneau/CodeMirror2
skirmish/CodeMirror2
skoon/CodeMirror2
sourcelair/CodeMirror
sparkartgroup-archive/CodeMirror2
strax/CodeMirror2
syntagmatic/CodeMirror2
tarr11/CodeMirror2
timelyportfolio/codemirrorR
timjb/CodeMirror
tpiccinini/CodeMirror2
treeform/CodeMirror2
ttscoff/CodeMirror2
tvoliter/CodeMirror2
uboness/CodeMirror2
utahguy/CodeMirror2
vegastexteditor/CodeMirror2
vestimir/CodeMirror2
vmx/CodeMirror2
vodori/CodeMirror2
waywardmonkeys/CodeMirror
whalefood/CodeMirror2
wmchristie/CodeMirror2
wwwlicious/CodeMirror2
xsocher/CodeMirror2
youngrok/CodeMirror2
zarazi/CodeMirror2
zires/CodeMirror2
zptcsoft/CodeMirror
Nothing to show
Choose a base branch
Nothing to show
Choose a Head Repository
codemirror/CodeMirror
Benvie/CodeMirror
BrendonSled/CodeMirror2
Brijen/CodeMirror2
CodePen/CodeMirrorEditor
DarioGT/CodeMirror2
GerHobbelt/CodeMirror2
GordonSmith/CodeMirror2
Gozala/CodeMirror
Kodowa/CodeMirror
MariusKarthaus/CodeMirror2
MichaelaIvanova/CodeMirror
NV/CodeMirror
Naatan/CodeMirror2
Nahrae/CodeMirror
Necrathex/CodeMirror2
NikhilS/CodeMirror2
Page-/CodeMirror2
ProPuke/CodeMirror2
Raynes/CodeMirror2
SimonWaldherrArchive/CodeMirror2
Suor/CodeMirror2
TheColorRed/CodeMirror2
TypedLambda/CodeMirror2
Visheshk/CodeMirror2
WebKutir/CodeMirror2
WolfgangKluge/CodeMirror2
achicu/CodeMirror2
adam-singer/CodeMirror2
adanlobato/CodeMirror2
adobe/CodeMirror2
aklaswad/CodeMirror2
alexey-k/CodeMirror2
amphro/CodeMirror2
ananyasen/CodeMirror2
andrecharland/CodeMirror2
ankit/CodeMirror2
areos/CodeMirror2
atul-bhouraskar/CodeMirror2
axtro/CodeMirror2
ayachi/CodeMirror2
benbunk/CodeMirror2
bengillies/CodeMirror2
billortell/CodeMirror2
blackvladimir/CodeMirror2
bnowel/CodeMirror2
borawjm/CodeMirror2
botelho/CodeMirror
bridger/CodeMirror2
bsletten/CodeMirror2
capacman/CodeMirror2
captn3m0/CodeMirror2
cethap/CodeMirror2
charles-cai/CodeMirror2
charlieroberts/CodeMirror2
chendeng/CodeMirror2
chris-morgan/CodeMirror2
cicloid/CodeMirror2
ciptard/CodeMirror2
clarkbox/CodeMirror2
clemos/CodeMirror2
cliffkoh/CodeMirror2
cloudgiant/CodeMirror2
codio/CodeMirror
contributed/CodeMirror2
dbja/CodeMirror2
deebugger/CodeMirror2
djiang/CodeMirror2
dparnell/CodeMirror2
durdn/CodeMirror2
dxw/CodeMirror2
dynosmurf/CodeMirror2
dyoo/CodeMirror2
ekhaled/CodeMirror2
espadrine/CodeMirror
est/CodeMirror2
existdissolve/CodeMirror2
fbuchinger/CodeMirror2
felmoon/CodeMirror2
femhub/CodeMirror2
flyabroad/CodeMirror2
fourchette/CodeMirror2
fpo123/CodeMirror2
fprochazka/CodeMirror2
frawa/TestCodeMirror2
fzzr-/CodeMirror2
galambalazs/CodeMirror2
gavriguy/CodeMirror2
greengiant/CodeMirror2
gzdw/CodeMirror2
hans/CodeMirror2
hanxianlong/CodeMirror2
ibdknox/CodeMirror
idflood/CodeMirror2
iee/CodeMirror2
infinnity/CodeMirror2
ingrid/CodeMirror2
j6mes/CodeMirror2
jankeromnes/CodeMirror
jasondavis/CodeMirror2
jbrinkman/CodeMirror2
jem/CodeMirror2
jenlure/CodeMirror2
jimmyoneill/CodeMirror2
jmwong/CodeMirror2
jongalloway/CodeMirror2
jots/CodeMirror2
joycse06/CodeMirror2
jurisv/CodeMirror2
kaniga/CodeMirror2
kasei/CodeMirror2
kjetilk/CodeMirror2
koide/CodeMirror2
koops/CodeMirror2
krockot/CodeMirror2
larscwallin/CodeMirror2
leafo/CodeMirror2
lgastako/CodeMirror2
lm/CodeMirror2
lopuhin/CodeMirror2
luojun/CodeMirror2
maks/CodeMirror2
mamboer/CodeMirror2
manyanlong/CodeMirror2
martn/CodeMirror2
massemanet/CodeMirror
maxkirsch/CodeMirror2
mb-crt/CodeMirror2
mbarkhau/CodeMirror2
mbrevoort/CodeMirror2-xquery
mcelrath/CodeMirror2
metzen/CodeMirror2
michalliu/CodeMirror2
michelemostarda/CodeMirror2
mimecuvalo/CodeMirror2
misfo/CodeMirror2
moon2l/CodeMirror2
movabletype/CodeMirror2
mozes/CodeMirror2
mwmessin/CodeMirror2
mwpark/CodeMirror2
mylittletools/CodeMirror2
mzero/CodeMirror2
nathansobo/CodeMirror2
nazriel/CodeMirror2
ndebeiss/CodeMirror2
nguillaumin/CodeMirror2
nitrous-io-zz/CodeMirror
njx/CodeMirror
nlwillia/CodeMirror2
nvdnkpr/CodeMirror2
onkis/CodeMirror2
oozou/CodeMirror2
openube/CodeMirror2
oxling/CodeMirror2
panchalmukundak/CodeMirror2
pavelfeldman/CodeMirror
peteguhl/CodeMirror2
peterarmstrong/CodeMirror2
peterkroon/CodeMirror2
pombredanne/CodeMirror2
pplaquette/CodeMirror2
purplecabbage/CodeMirror2
rascalmicro/CodeMirror2
rduenasf/CodeMirror2
robermorales/CodeMirror2
robhawkes/CodeMirror2
samuela/CodeMirror2
satchit/CodeMirror2
seanmcgary/CodeMirror2
siefkenj/CodeMirror2
simoneau/CodeMirror2
skirmish/CodeMirror2
skoon/CodeMirror2
sourcelair/CodeMirror
sparkartgroup-archive/CodeMirror2
strax/CodeMirror2
syntagmatic/CodeMirror2
tarr11/CodeMirror2
timelyportfolio/codemirrorR
timjb/CodeMirror
tpiccinini/CodeMirror2
treeform/CodeMirror2
ttscoff/CodeMirror2
tvoliter/CodeMirror2
uboness/CodeMirror2
utahguy/CodeMirror2
vegastexteditor/CodeMirror2
vestimir/CodeMirror2
vmx/CodeMirror2
vodori/CodeMirror2
waywardmonkeys/CodeMirror
whalefood/CodeMirror2
wmchristie/CodeMirror2
wwwlicious/CodeMirror2
xsocher/CodeMirror2
youngrok/CodeMirror2
zarazi/CodeMirror2
zires/CodeMirror2
zptcsoft/CodeMirror
Nothing to show
Choose a head branch
Nothing to show
12
contributors
Commits on Feb 20, 2015
|
|
marijnh |
Bump version number post-5.0
|
e11c327
|
|||
|
|
marijnh |
[release notes] Fix bad patches link
|
2e59119
|
Commits on Feb 23, 2015
Commits on Feb 24, 2015
|
|
marijnh |
[contenteditable input] Work around mobile firefox randomly resetting…
… selection sometimes |
28b25a4
|
|||
|
|
marijnh |
[htmlembedded mode] Strip down to a simple addon/mode/multiplex wrapper
At least that works. Closes #1788 |
6d115cd
|
|||
|
|
marijnh |
[smarty mode] Clean up, add support for base mode
Issue #2871 |
144f29b
|
|||
|
|
marijnh |
[smartymixed mode] Delete
It was a broken mess. The Smarty mode now supports a base mode. Issue #2871 |
92ed45f
|
|||
|
|
marijnh |
[manual] Add a short description of the lint validator interface
Closes #3073 |
a5e22b7
|
|||
|
|
marijnh |
[merge addon] Define goNextDiff and goPrevDiff commands
Closes #2858 |
fb78920
|
|||
|
|
marijnh |
[foldgutter addon] Make sure unfolding markers work, even when fold r…
…ange is broken Closes #2581 |
c1d2502
|
Commits on Feb 25, 2015
|
|
marijnh |
Also force box-sizing: content-box for CodeMirror-gutters
Issue #3098 |
a1d45cf
|
|||
|
|
marijnh |
[mdn-like theme] Remove margin on linenumber element
Margins for gutter markers aren't supported, and this was pushing the numbers into the content. Issue #3098 |
3a40888
|
Commits on Feb 26, 2015
|
|
marijnh |
[lint addon] Prevent events/timeouts trying to run after addon has be…
…en disabled Issue #3104 |
cd6a1a7
|
|||
|
|
marijnh |
[mllike mode] Fix bad usage of object as dictionary
Looking up arbitrary strings without a hasOwnProperty check never ends well. Closes #3106 |
14c07d5
|
Commits on Feb 27, 2015
|
|
coderaiser + marijnh |
[yaml mode] add ext "yml"
|
e78b5ab
|
Commits on Mar 02, 2015
Commits on Mar 04, 2015
|
|
nightwing + mightyguava |
[vim] fix search motion
|
dfad61d
|
Commits on Mar 05, 2015
|
|
peterflynn + marijnh |
[sass mode] Fix typo that was introduced by 9e56052
|
dad7abf
|
|||
|
|
kevinearls + marijnh |
[properties mode] Fix handling of line-continuation backslash
Closes #3114 |
4485ae7
|
|||
|
|
marijnh |
[manual] Mention the fact that editor instances are passed to lint fu…
…nctions Closes #3113 |
313e238
|
|||
|
|
marijnh |
Fix interpretation of specialchars not happening on init
Thus allowing a user to specify a non-global regexp, causing a hang in buildToken Issue #3117 |
572f6f2
|
|||
|
|
marijnh |
Don't apply special character filter to nbsps generated by space-spli…
…tting Issue #3117 |
acdb74d
|
|||
|
|
marijnh |
Add extra pixel to line number gutter width
Also set CodeMirror-linenumber to nowrap. Works around issue where a rounding error causes the line numbers to wrap in some situations on iOS. Closes #3068 |
94a6714
|
Commits on Mar 06, 2015
|
|
marijnh |
[closebrackets addon] Don't rely on the set of brackets being static
|
dbdc448
|
|||
|
|
marijnh |
[closebrackets addon] Make closing rules configurable per mode
Make JavaScript mode autoclose backticks, remove single quote closing for Lisp modes, and add explicit triple-quote rule to languages supporting triple quoting. Issue #3110 |
e1cda70
|
Commits on Mar 07, 2015
Commits on Mar 12, 2015
|
|
marijnh |
Add parameter to status_s.png in attempt to force override github's c…
…ache |
def1242
|
Commits on Mar 14, 2015
Commits on Mar 18, 2015
Commits on Mar 19, 2015
|
|
marijnh |
[css-hint addon] Complete !important
Closes #3141 |
c6440ee
|
Commits on Mar 20, 2015
Commits on Mar 23, 2015
|
|
marijnh |
Work around Firefox's undo in context menu causing odd side effects
It doesn't seem to be possible to capture it an perform an actual undo, unfortunately. Issue #3142 |
ad74295
|
|||
|
|
marijnh |
[vb mode] Register a list of hintWords
|
09f032d
|
|||
|
|
marijnh |
Mark release 5.1.0
|
8fa467e
|
Unified
Split
Showing
with
1,946 additions
and 1,213 deletions.
- +3 −0 AUTHORS
- +1 −1 README.md
- +3 −1 addon/dialog/dialog.js
- +144 −121 addon/edit/closebrackets.js
- +4 −2 addon/fold/foldgutter.js
- +4 −0 addon/hint/css-hint.js
- +13 −8 addon/hint/sql-hint.js
- +2 −0 addon/lint/lint.js
- +40 −0 addon/merge/merge.js
- +8 −2 addon/scroll/simplescrollbars.js
- +1 −1 addon/tern/tern.js
- +1 −1 bower.json
- +4 −1 doc/compress.html
- +20 −6 doc/manual.html
- +26 −6 doc/releases.html
- +1 −1 index.html
- +13 −0 keymap/sublime.js
- +43 −54 keymap/vim.js
- +11 −8 lib/codemirror.css
- +104 −64 lib/codemirror.js
- +73 −0 mode/asciiarmor/asciiarmor.js
- +46 −0 mode/asciiarmor/index.html
- +2 −1 mode/clike/clike.js
- +1 −0 mode/clojure/clojure.js
- +97 −0 mode/cmake/cmake.js
- +129 −0 mode/cmake/index.html
- +1 −0 mode/commonlisp/commonlisp.js
- +1 −0 mode/css/css.js
- +1 −1 mode/css/less.html
- +1 −1 mode/css/scss.html
- +1 −0 mode/groovy/groovy.js
- +18 −76 mode/htmlembedded/htmlembedded.js
- +1 −0 mode/htmlembedded/index.html
- +3 −2 mode/index.html
- +5 −0 mode/javascript/javascript.js
- +1 −0 mode/kotlin/kotlin.js
- +4 −2 mode/meta.js
- +1 −1 mode/mllike/mllike.js
- +1 −1 mode/properties/properties.js
- +1 −0 mode/python/python.js
- +1 −1 mode/sass/sass.js
- +1 −0 mode/scheme/scheme.js
- +39 −37 mode/smarty/index.html
- +100 −107 mode/smarty/smarty.js
- +0 −114 mode/smartymixed/index.html
- +0 −197 mode/smartymixed/smartymixed.js
- +5 −3 mode/stylus/index.html
- +651 −332 mode/stylus/stylus.js
- +146 −0 mode/troff/index.html
- +82 −0 mode/troff/troff.js
- +6 −5 mode/vb/vb.js
- +53 −53 mode/verilog/verilog.js
- +1 −1 package.json
- +7 −0 test/test.js
- +19 −0 test/vim_test.js
- +1 −1 theme/mdn-like.css
View
3
AUTHORS
| @@ -87,6 +87,7 @@ Christian Petrov | ||
| Christopher Brown | ||
| ciaranj | ||
| CodeAnimal | ||
| +coderaiser | ||
| ComFreek | ||
| Curtis Gagliardi | ||
| dagsta | ||
| @@ -230,6 +231,7 @@ jwallers@gmail.com | ||
| kaniga | ||
| Ken Newman | ||
| Ken Rockot | ||
| +Kevin Earls | ||
| Kevin Sawicki | ||
| Kevin Ushey | ||
| Klaus Silveira | ||
| @@ -351,6 +353,7 @@ Randall Mason | ||
| Randy Burden | ||
| Randy Edmunds | ||
| Rasmus Erik Voel Jensen | ||
| +ray ratchup | ||
| Ray Ratchup | ||
| Richard van der Meer | ||
| Richard Z.H. Wang | ||
View
2
README.md
| @@ -1,7 +1,7 @@ | ||
| # CodeMirror | ||
| [](https://travis-ci.org/codemirror/CodeMirror) | ||
| [](https://www.npmjs.org/package/codemirror) | ||
| -[Funding status: ](https://marijnhaverbeke.nl/fund/) | ||
| +[Funding status: ](https://marijnhaverbeke.nl/fund/) | ||
| CodeMirror is a JavaScript component that provides a code editor in | ||
| the browser. When a mode is available for the language you are coding | ||
View
4
addon/dialog/dialog.js
| @@ -58,7 +58,9 @@ | ||
| if (inp) { | ||
| if (options.value) { | ||
| inp.value = options.value; | ||
| - inp.select(); | ||
| + if (options.selectValueOnOpen !== false) { | ||
| + inp.select(); | ||
| + } | ||
| } | ||
| if (options.onInput) | ||
View
265
addon/edit/closebrackets.js
| @@ -9,29 +9,157 @@ | ||
| else // Plain browser env | ||
| mod(CodeMirror); | ||
| })(function(CodeMirror) { | ||
| - var DEFAULT_BRACKETS = "()[]{}''\"\""; | ||
| - var DEFAULT_TRIPLES = "'\""; | ||
| - var DEFAULT_EXPLODE_ON_ENTER = "[]{}"; | ||
| - var SPACE_CHAR_REGEX = /\s/; | ||
| + var defaults = { | ||
| + pairs: "()[]{}''\"\"", | ||
| + triples: "", | ||
| + explode: "[]{}" | ||
| + }; | ||
| var Pos = CodeMirror.Pos; | ||
| CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) { | ||
| - if (old != CodeMirror.Init && old) | ||
| - cm.removeKeyMap("autoCloseBrackets"); | ||
| - if (!val) return; | ||
| - var pairs = DEFAULT_BRACKETS, triples = DEFAULT_TRIPLES, explode = DEFAULT_EXPLODE_ON_ENTER; | ||
| - if (typeof val == "string") pairs = val; | ||
| - else if (typeof val == "object") { | ||
| - if (val.pairs != null) pairs = val.pairs; | ||
| - if (val.triples != null) triples = val.triples; | ||
| - if (val.explode != null) explode = val.explode; | ||
| + if (old && old != CodeMirror.Init) { | ||
| + cm.removeKeyMap(keyMap); | ||
| + cm.state.closeBrackets = null; | ||
| + } | ||
| + if (val) { | ||
| + cm.state.closeBrackets = val; | ||
| + cm.addKeyMap(keyMap); | ||
| } | ||
| - var map = buildKeymap(pairs, triples); | ||
| - if (explode) map.Enter = buildExplodeHandler(explode); | ||
| - cm.addKeyMap(map); | ||
| }); | ||
| + function getOption(conf, name) { | ||
| + if (name == "pairs" && typeof conf == "string") return conf; | ||
| + if (typeof conf == "object" && conf[name] != null) return conf[name]; | ||
| + return defaults[name]; | ||
| + } | ||
| + | ||
| + var bind = defaults.pairs + "`"; | ||
| + var keyMap = {Backspace: handleBackspace, Enter: handleEnter}; | ||
| + for (var i = 0; i < bind.length; i++) | ||
| + keyMap["'" + bind.charAt(i) + "'"] = handler(bind.charAt(i)); | ||
| + | ||
| + function handler(ch) { | ||
| + return function(cm) { return handleChar(cm, ch); }; | ||
| + } | ||
| + | ||
| + function getConfig(cm) { | ||
| + var deflt = cm.state.closeBrackets; | ||
| + if (!deflt) return null; | ||
| + var mode = cm.getModeAt(cm.getCursor()); | ||
| + return mode.closeBrackets || deflt; | ||
| + } | ||
| + | ||
| + function handleBackspace(cm) { | ||
| + var conf = getConfig(cm); | ||
| + if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass; | ||
| + | ||
| + var pairs = getOption(conf, "pairs"); | ||
| + var ranges = cm.listSelections(); | ||
| + for (var i = 0; i < ranges.length; i++) { | ||
| + if (!ranges[i].empty()) return CodeMirror.Pass; | ||
| + var around = charsAround(cm, ranges[i].head); | ||
| + if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass; | ||
| + } | ||
| + for (var i = ranges.length - 1; i >= 0; i--) { | ||
| + var cur = ranges[i].head; | ||
| + cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1)); | ||
| + } | ||
| + } | ||
| + | ||
| + function handleEnter(cm) { | ||
| + var conf = getConfig(cm); | ||
| + var explode = conf && getOption(conf, "explode"); | ||
| + if (!explode || cm.getOption("disableInput")) return CodeMirror.Pass; | ||
| + | ||
| + var ranges = cm.listSelections(); | ||
| + for (var i = 0; i < ranges.length; i++) { | ||
| + if (!ranges[i].empty()) return CodeMirror.Pass; | ||
| + var around = charsAround(cm, ranges[i].head); | ||
| + if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass; | ||
| + } | ||
| + cm.operation(function() { | ||
| + cm.replaceSelection("\n\n", null); | ||
| + cm.execCommand("goCharLeft"); | ||
| + ranges = cm.listSelections(); | ||
| + for (var i = 0; i < ranges.length; i++) { | ||
| + var line = ranges[i].head.line; | ||
| + cm.indentLine(line, null, true); | ||
| + cm.indentLine(line + 1, null, true); | ||
| + } | ||
| + }); | ||
| + } | ||
| + | ||
| + function handleChar(cm, ch) { | ||
| + var conf = getConfig(cm); | ||
| + if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass; | ||
| + | ||
| + var pairs = getOption(conf, "pairs"); | ||
| + var pos = pairs.indexOf(ch); | ||
| + if (pos == -1) return CodeMirror.Pass; | ||
| + var triples = getOption(conf, "triples"); | ||
| + | ||
| + var identical = pairs.charAt(pos + 1) == ch; | ||
| + var ranges = cm.listSelections(); | ||
| + var opening = pos % 2 == 0; | ||
| + | ||
| + var type, next; | ||
| + for (var i = 0; i < ranges.length; i++) { | ||
| + var range = ranges[i], cur = range.head, curType; | ||
| + var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1)); | ||
| + if (opening && !range.empty()) { | ||
| + curType = "surround"; | ||
| + } else if ((identical || !opening) && next == ch) { | ||
| + if (triples.indexOf(ch) >= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch) | ||
| + curType = "skipThree"; | ||
| + else | ||
| + curType = "skip"; | ||
| + } else if (identical && cur.ch > 1 && triples.indexOf(ch) >= 0 && | ||
| + cm.getRange(Pos(cur.line, cur.ch - 2), cur) == ch + ch && | ||
| + (cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != ch)) { | ||
| + curType = "addFour"; | ||
| + } else if (identical) { | ||
| + if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, ch)) curType = "both"; | ||
| + else return CodeMirror.Pass; | ||
| + } else if (opening && (cm.getLine(cur.line).length == cur.ch || | ||
| + isClosingBracket(next, pairs) || | ||
| + /\s/.test(next))) { | ||
| + curType = "both"; | ||
| + } else { | ||
| + return CodeMirror.Pass; | ||
| + } | ||
| + if (!type) type = curType; | ||
| + else if (type != curType) return CodeMirror.Pass; | ||
| + } | ||
| + | ||
| + var left = pos % 2 ? pairs.charAt(pos - 1) : ch; | ||
| + var right = pos % 2 ? ch : pairs.charAt(pos + 1); | ||
| + cm.operation(function() { | ||
| + if (type == "skip") { | ||
| + cm.execCommand("goCharRight"); | ||
| + } else if (type == "skipThree") { | ||
| + for (var i = 0; i < 3; i++) | ||
| + cm.execCommand("goCharRight"); | ||
| + } else if (type == "surround") { | ||
| + var sels = cm.getSelections(); | ||
| + for (var i = 0; i < sels.length; i++) | ||
| + sels[i] = left + sels[i] + right; | ||
| + cm.replaceSelections(sels, "around"); | ||
| + } else if (type == "both") { | ||
| + cm.replaceSelection(left + right, null); | ||
| + cm.execCommand("goCharLeft"); | ||
| + } else if (type == "addFour") { | ||
| + cm.replaceSelection(left + left + left + left, "before"); | ||
| + cm.execCommand("goCharRight"); | ||
| + } | ||
| + }); | ||
| + } | ||
| + | ||
| + function isClosingBracket(ch, pairs) { | ||
| + var pos = pairs.lastIndexOf(ch); | ||
| + return pos > -1 && pos % 2 == 1; | ||
| + } | ||
| + | ||
| function charsAround(cm, pos) { | ||
| var str = cm.getRange(Pos(pos.line, pos.ch - 1), | ||
| Pos(pos.line, pos.ch + 1)); | ||
| @@ -53,109 +181,4 @@ | ||
| stream.start = stream.pos; | ||
| } | ||
| } | ||
| - | ||
| - function buildKeymap(pairs, triples) { | ||
| - var map = { | ||
| - name : "autoCloseBrackets", | ||
| - Backspace: function(cm) { | ||
| - if (cm.getOption("disableInput")) return CodeMirror.Pass; | ||
| - var ranges = cm.listSelections(); | ||
| - for (var i = 0; i < ranges.length; i++) { | ||
| - if (!ranges[i].empty()) return CodeMirror.Pass; | ||
| - var around = charsAround(cm, ranges[i].head); | ||
| - if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass; | ||
| - } | ||
| - for (var i = ranges.length - 1; i >= 0; i--) { | ||
| - var cur = ranges[i].head; | ||
| - cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1)); | ||
| - } | ||
| - } | ||
| - }; | ||
| - var closingBrackets = ""; | ||
| - for (var i = 0; i < pairs.length; i += 2) (function(left, right) { | ||
| - closingBrackets += right; | ||
| - map["'" + left + "'"] = function(cm) { | ||
| - if (cm.getOption("disableInput")) return CodeMirror.Pass; | ||
| - var ranges = cm.listSelections(), type, next; | ||
| - for (var i = 0; i < ranges.length; i++) { | ||
| - var range = ranges[i], cur = range.head, curType; | ||
| - var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1)); | ||
| - if (!range.empty()) { | ||
| - curType = "surround"; | ||
| - } else if (left == right && next == right) { | ||
| - if (cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == left + left + left) | ||
| - curType = "skipThree"; | ||
| - else | ||
| - curType = "skip"; | ||
| - } else if (left == right && cur.ch > 1 && triples.indexOf(left) >= 0 && | ||
| - cm.getRange(Pos(cur.line, cur.ch - 2), cur) == left + left && | ||
| - (cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != left)) { | ||
| - curType = "addFour"; | ||
| - } else if (left == '"' || left == "'") { | ||
| - if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, left)) curType = "both"; | ||
| - else return CodeMirror.Pass; | ||
| - } else if (cm.getLine(cur.line).length == cur.ch || closingBrackets.indexOf(next) >= 0 || SPACE_CHAR_REGEX.test(next)) { | ||
| - curType = "both"; | ||
| - } else { | ||
| - return CodeMirror.Pass; | ||
| - } | ||
| - if (!type) type = curType; | ||
| - else if (type != curType) return CodeMirror.Pass; | ||
| - } | ||
| - | ||
| - cm.operation(function() { | ||
| - if (type == "skip") { | ||
| - cm.execCommand("goCharRight"); | ||
| - } else if (type == "skipThree") { | ||
| - for (var i = 0; i < 3; i++) | ||
| - cm.execCommand("goCharRight"); | ||
| - } else if (type == "surround") { | ||
| - var sels = cm.getSelections(); | ||
| - for (var i = 0; i < sels.length; i++) | ||
| - sels[i] = left + sels[i] + right; | ||
| - cm.replaceSelections(sels, "around"); | ||
| - } else if (type == "both") { | ||
| - cm.replaceSelection(left + right, null); | ||
| - cm.execCommand("goCharLeft"); | ||
| - } else if (type == "addFour") { | ||
| - cm.replaceSelection(left + left + left + left, "before"); | ||
| - cm.execCommand("goCharRight"); | ||
| - } | ||
| - }); | ||
| - }; | ||
| - if (left != right) map["'" + right + "'"] = function(cm) { | ||
| - var ranges = cm.listSelections(); | ||
| - for (var i = 0; i < ranges.length; i++) { | ||
| - var range = ranges[i]; | ||
| - if (!range.empty() || | ||
| - cm.getRange(range.head, Pos(range.head.line, range.head.ch + 1)) != right) | ||
| - return CodeMirror.Pass; | ||
| - } | ||
| - cm.execCommand("goCharRight"); | ||
| - }; | ||
| - })(pairs.charAt(i), pairs.charAt(i + 1)); | ||
| - return map; | ||
| - } | ||
| - | ||
| - function buildExplodeHandler(pairs) { | ||
| - return function(cm) { | ||
| - if (cm.getOption("disableInput")) return CodeMirror.Pass; | ||
| - var ranges = cm.listSelections(); | ||
| - for (var i = 0; i < ranges.length; i++) { | ||
| - if (!ranges[i].empty()) return CodeMirror.Pass; | ||
| - var around = charsAround(cm, ranges[i].head); | ||
| - if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass; | ||
| - } | ||
| - cm.operation(function() { | ||
| - cm.replaceSelection("\n\n", null); | ||
| - cm.execCommand("goCharLeft"); | ||
| - ranges = cm.listSelections(); | ||
| - for (var i = 0; i < ranges.length; i++) { | ||
| - var line = ranges[i].head.line; | ||
| - cm.indentLine(line, null, true); | ||
| - cm.indentLine(line + 1, null, true); | ||
| - } | ||
| - }); | ||
| - }; | ||
| - } | ||
| }); | ||
View
6
addon/fold/foldgutter.js
| @@ -52,7 +52,7 @@ | ||
| function isFolded(cm, line) { | ||
| var marks = cm.findMarksAt(Pos(line)); | ||
| for (var i = 0; i < marks.length; ++i) | ||
| - if (marks[i].__isFold && marks[i].find().from.line == line) return true; | ||
| + if (marks[i].__isFold && marks[i].find().from.line == line) return marks[i]; | ||
| } | ||
| function marker(spec) { | ||
| @@ -98,7 +98,9 @@ | ||
| if (!state) return; | ||
| var opts = state.options; | ||
| if (gutter != opts.gutter) return; | ||
| - cm.foldCode(Pos(line, 0), opts.rangeFinder); | ||
| + var folded = isFolded(cm, line); | ||
| + if (folded) folded.clear(); | ||
| + else cm.foldCode(Pos(line, 0), opts.rangeFinder); | ||
| } | ||
| function onChange(cm) { | ||
View
4
addon/hint/css-hint.js
| @@ -20,6 +20,10 @@ | ||
| var inner = CodeMirror.innerMode(cm.getMode(), token.state); | ||
| if (inner.mode.name != "css") return; | ||
| + if (token.type == "keyword" && "!important".indexOf(token.string) == 0) | ||
| + return {list: ["!important"], from: CodeMirror.Pos(cur.line, token.start), | ||
| + to: CodeMirror.Pos(cur.line, token.end)}; | ||
| + | ||
| var start = token.start, end = cur.ch, word = token.string.slice(0, end - start); | ||
| if (/[^\w$_-]/.test(word)) { | ||
| word = ""; start = end = cur.ch; | ||
Oops, something went wrong.