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
26
contributors
Commits on Oct 21, 2013
|
|
marijnh |
Bump version number post-3.19
|
a540182
|
Commits on Oct 22, 2013
Commits on Oct 23, 2013
|
|
njx + marijnh |
Always move cursor to end of indent even if whitespace didn't change
|
32d7db0
|
Commits on Oct 24, 2013
Commits on Oct 26, 2013
|
|
marijnh |
Fix undesirable selection-mangling in indentLine
Issue #1910 |
759b3a0
|
Commits on Oct 28, 2013
|
|
marijnh |
[javascript mode] Fix bug in recognizing local variable in nested con…
…text |
8d000dd
|
Commits on Oct 29, 2013
Commits on Oct 30, 2013
|
|
marijnh |
[haskell mode] Fix unintended prototype property access bug
Closes #1917 |
0d32c1e
|
Commits on Oct 31, 2013
Commits on Nov 03, 2013
Commits on Nov 04, 2013
Commits on Nov 05, 2013
|
|
marijnh |
Add IE11+ detection, use it to fix failing test
Closes #1826 |
575a29a
|
|||
|
|
marijnh |
[coffeescript mode] Some refinement in indentation
Issue #1932 |
567a94b
|
Commits on Nov 06, 2013
Commits on Nov 11, 2013
Commits on Nov 13, 2013
|
|
marijnh |
[htmlmixed mode] Fix bug in intra-token-closetag detection
Issue #1943 |
a98a026
|
|||
|
|
Pavel Strashkin + marijnh |
[show-hint addon] Fix event delegation for UL/LI
It's possible to provide custom markup for hint elements that are LI tags and that breaks event delegation logic that expects UL to have text-only LI nodes. As a result if you have elements inside LI and click/dblclick on those, nothing happens and selected hint is not applied. The fix improves event delegation in the way to find nearest parent element to event target that is a hint element at the same time. |
8f87175
|
|||
|
|
marijnh |
[show-hint addon] Style fixes
Issue #1947 |
443f511
|
|||
|
|
Juho Vuori + marijnh |
[show-hint addon] Allow a specific option to be selected by default
|
1013ebb
|
|||
|
|
Primigenus + marijnh |
[real-world uses] Update link to Handcraft
|
26e955d
|
|||
|
|
cben + marijnh |
[markdown] Emit 'header1'..'header6' styles in addition to 'header'.
|
e327d2f
|
|||
|
|
idlecool + marijnh |
[ambiance theme] Text selection uses default background color
`cm-s-ambiance` and `CodeMirror-focused` are classes to the same element, so search for `.cm-s-ambiance .CodeMirror-focused` will fail. |
2c55303
|
|||
|
|
marijnh |
[docs] Remove underlines for headers
|
4ca5380
|
|||
|
|
marijnh |
[show-hint addon] Fix bug introduced by merging 1013ebb
|
e7cb292
|
Commits on Nov 14, 2013
Commits on Nov 15, 2013
|
|
marijnh |
[javascript mode] Add support for ES6 quasiquotes
|
d85b8c4
|
|||
|
|
marijnh |
[javascript mode] Use 'extends' instead of parenthesized syntax for i…
…nheritance |
a31c335
|
Commits on Nov 18, 2013
|
|
marijnh |
[javascript mode] Fix indentation of 'else' lines
Issue #1960 |
37ee207
|
Commits on Nov 19, 2013
Commits on Nov 21, 2013
|
|
marijnh |
Fix completely botched IE11+ check
|
53cce13
|
|||
|
|
marijnh |
Export lineNo utility
Issue #1969 |
31a77ad
|
|||
|
|
marijnh |
Make lineNo a method after all
Issue #1969 |
2546a4a
|
|||
|
|
marijnh |
Add (undocumented) wholeLineUpdateBefore option
|
d07ec7e
|
|||
|
|
xFlatlinex + marijnh |
[placeholder addon] Don't hide placeholder text on focus
Most modern browsers now keep displaying the placeholder even if the user has focus on the input and only hide it when the input has content. This change is to make this addon consistent with this, so users won't tell the difference with native inputs' placeholder behaviour. |
9aa2240
|
|||
|
|
marijnh |
Mark release 3.20
|
0e58d2c
|
Unified
Split
Showing
with
1,226 additions
and 227 deletions.
- +42 −1 addon/dialog/dialog.js
- +2 −1 addon/display/fullscreen.js
- +0 −6 addon/display/placeholder.js
- +13 −11 addon/edit/closetag.js
- +2 −1 addon/edit/matchbrackets.js
- +4 −4 addon/fold/foldgutter.js
- +25 −21 addon/fold/indent-fold.js
- +1 −0 addon/hint/javascript-hint.js
- +20 −8 addon/hint/show-hint.js
- +7 −7 addon/tern/tern.js
- +1 −0 demo/tern.html
- +7 −1 demo/variableheight.html
- +3 −0 doc/compress.html
- +0 −1 doc/docs.css
- +32 −12 doc/manual.html
- +3 −1 doc/realworld.html
- +11 −0 doc/releases.html
- +1 −1 index.html
- +3 −4 keymap/vim.js
- +61 −27 lib/codemirror.js
- +2 −2 mode/clike/index.html
- +13 −8 mode/coffeescript/coffeescript.js
- +3 −3 mode/css/css.js
- +9 −0 mode/css/scss_test.js
- +12 −0 mode/css/test.js
- +1 −1 mode/go/go.js
- +1 −1 mode/haskell/haskell.js
- +1 −1 mode/htmlmixed/htmlmixed.js
- +2 −0 mode/index.html
- +216 −79 mode/javascript/javascript.js
- +62 −0 mode/javascript/test.js
- +187 −0 mode/julia/index.html
- +262 −0 mode/julia/julia.js
- +4 −2 mode/less/less.js
- +16 −7 mode/markdown/markdown.js
- +19 −11 mode/markdown/test.js
- +3 −1 mode/meta.js
- +66 −0 mode/pegjs/index.html
- +103 −0 mode/pegjs/pegjs.js
- +1 −1 mode/pig/pig.js
- +1 −1 package.json
- +1 −1 theme/ambiance.css
- +3 −1 theme/mbo.css
View
43
addon/dialog/dialog.js
| @@ -10,11 +10,22 @@ | ||
| } else { | ||
| dialog.className = "CodeMirror-dialog CodeMirror-dialog-top"; | ||
| } | ||
| - dialog.innerHTML = template; | ||
| + if (typeof template == "string") { | ||
| + dialog.innerHTML = template; | ||
| + } else { // Assuming it's a detached DOM element. | ||
| + dialog.appendChild(template); | ||
| + } | ||
| return dialog; | ||
| } | ||
| + function closeNotification(cm, newVal) { | ||
| + if (cm.state.currentNotificationClose) | ||
| + cm.state.currentNotificationClose(); | ||
| + cm.state.currentNotificationClose = newVal; | ||
| + } | ||
| + | ||
| CodeMirror.defineExtension("openDialog", function(template, callback, options) { | ||
| + closeNotification(this, null); | ||
| var dialog = dialogDiv(this, template, options && options.bottom); | ||
| var closed = false, me = this; | ||
| function close() { | ||
| @@ -51,6 +62,7 @@ | ||
| }); | ||
| CodeMirror.defineExtension("openConfirm", function(template, callbacks, options) { | ||
| + closeNotification(this, null); | ||
| var dialog = dialogDiv(this, template, options && options.bottom); | ||
| var buttons = dialog.getElementsByTagName("button"); | ||
| var closed = false, me = this, blurring = 1; | ||
| @@ -77,4 +89,33 @@ | ||
| CodeMirror.on(b, "focus", function() { ++blurring; }); | ||
| } | ||
| }); | ||
| + | ||
| + /* | ||
| + * openNotification | ||
| + * Opens a notification, that can be closed with an optional timer | ||
| + * (default 5000ms timer) and always closes on click. | ||
| + * | ||
| + * If a notification is opened while another is opened, it will close the | ||
| + * currently opened one and open the new one immediately. | ||
| + */ | ||
| + CodeMirror.defineExtension("openNotification", function(template, options) { | ||
| + closeNotification(this, close); | ||
| + var dialog = dialogDiv(this, template, options && options.bottom); | ||
| + var duration = options && (options.duration === undefined ? 5000 : options.duration); | ||
| + var closed = false, doneTimer; | ||
| + | ||
| + function close() { | ||
| + if (closed) return; | ||
| + closed = true; | ||
| + clearTimeout(doneTimer); | ||
| + dialog.parentNode.removeChild(dialog); | ||
| + } | ||
| + | ||
| + CodeMirror.on(dialog, 'click', function(e) { | ||
| + CodeMirror.e_preventDefault(e); | ||
| + close(); | ||
| + }); | ||
| + if (duration) | ||
| + doneTimer = setTimeout(close, options.duration); | ||
| + }); | ||
| })(); | ||
View
3
addon/display/fullscreen.js
| @@ -12,7 +12,8 @@ | ||
| var wrap = cm.getWrapperElement(); | ||
| cm.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset, | ||
| width: wrap.style.width, height: wrap.style.height}; | ||
| - wrap.style.width = wrap.style.height = ""; | ||
| + wrap.style.width = ""; | ||
| + wrap.style.height = "auto"; | ||
| wrap.className += " CodeMirror-fullscreen"; | ||
| document.documentElement.style.overflow = "hidden"; | ||
| cm.refresh(); | ||
View
6
addon/display/placeholder.js
| @@ -2,12 +2,10 @@ | ||
| CodeMirror.defineOption("placeholder", "", function(cm, val, old) { | ||
| var prev = old && old != CodeMirror.Init; | ||
| if (val && !prev) { | ||
| - cm.on("focus", onFocus); | ||
| cm.on("blur", onBlur); | ||
| cm.on("change", onChange); | ||
| onChange(cm); | ||
| } else if (!val && prev) { | ||
| - cm.off("focus", onFocus); | ||
| cm.off("blur", onBlur); | ||
| cm.off("change", onChange); | ||
| clearPlaceholder(cm); | ||
| @@ -33,17 +31,13 @@ | ||
| cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild); | ||
| } | ||
| - function onFocus(cm) { | ||
| - clearPlaceholder(cm); | ||
| - } | ||
| function onBlur(cm) { | ||
| if (isEmpty(cm)) setPlaceholder(cm); | ||
| } | ||
| function onChange(cm) { | ||
| var wrapper = cm.getWrapperElement(), empty = isEmpty(cm); | ||
| wrapper.className = wrapper.className.replace(" CodeMirror-empty", "") + (empty ? " CodeMirror-empty" : ""); | ||
| - if (cm.hasFocus()) return; | ||
| if (empty) setPlaceholder(cm); | ||
| else clearPlaceholder(cm); | ||
| } | ||
View
24
addon/edit/closetag.js
| @@ -24,16 +24,15 @@ | ||
| (function() { | ||
| CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) { | ||
| - if (val && (old == CodeMirror.Init || !old)) { | ||
| - var map = {name: "autoCloseTags"}; | ||
| - if (typeof val != "object" || val.whenClosing) | ||
| - map["'/'"] = function(cm) { return autoCloseSlash(cm); }; | ||
| - if (typeof val != "object" || val.whenOpening) | ||
| - map["'>'"] = function(cm) { return autoCloseGT(cm); }; | ||
| - cm.addKeyMap(map); | ||
| - } else if (!val && (old != CodeMirror.Init && old)) { | ||
| + if (old != CodeMirror.Init && old) | ||
| cm.removeKeyMap("autoCloseTags"); | ||
| - } | ||
| + if (!val) return; | ||
| + var map = {name: "autoCloseTags"}; | ||
| + if (typeof val != "object" || val.whenClosing) | ||
| + map["'/'"] = function(cm) { return autoCloseSlash(cm); }; | ||
| + if (typeof val != "object" || val.whenOpening) | ||
| + map["'>'"] = function(cm) { return autoCloseGT(cm); }; | ||
| + cm.addKeyMap(map); | ||
| }); | ||
| var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", | ||
| @@ -54,7 +53,8 @@ | ||
| if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch); | ||
| var lowerTagName = tagName.toLowerCase(); | ||
| // Don't process the '>' at the end of an end-tag or self-closing tag | ||
| - if (tok.type == "tag" && state.type == "closeTag" || | ||
| + if (tok.type == "string" && (tok.end != pos.ch || !/[\"\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) || | ||
| + tok.type == "tag" && state.type == "closeTag" || | ||
| tok.string.indexOf("/") == (tok.string.length - 1) || // match something like <someTagName /> | ||
| dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1) | ||
| return CodeMirror.Pass; | ||
| @@ -72,7 +72,9 @@ | ||
| function autoCloseSlash(cm) { | ||
| var pos = cm.getCursor(), tok = cm.getTokenAt(pos); | ||
| var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state; | ||
| - if (tok.string.charAt(0) != "<" || tok.start != pos.ch - 1 || inner.mode.name != "xml") return CodeMirror.Pass; | ||
| + if (tok.type == "string" || tok.string.charAt(0) != "<" || | ||
| + tok.start != pos.ch - 1 || inner.mode.name != "xml") | ||
| + return CodeMirror.Pass; | ||
| var tagName = state.context && state.context.tagName; | ||
| if (tagName) cm.replaceSelection("/" + tagName + ">", "end"); | ||
View
3
addon/edit/matchbrackets.js
| @@ -8,6 +8,7 @@ | ||
| function findMatchingBracket(cm, where, strict) { | ||
| var state = cm.state.matchBrackets; | ||
| var maxScanLen = (state && state.maxScanLineLength) || 10000; | ||
| + var maxScanLines = (state && state.maxScanLines) || 100; | ||
| var cur = where || cm.getCursor(), line = cm.getLineHandle(cur.line), pos = cur.ch - 1; | ||
| var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)]; | ||
| @@ -32,7 +33,7 @@ | ||
| } | ||
| } | ||
| } | ||
| - for (var i = cur.line, found, e = forward ? Math.min(i + 100, cm.lineCount()) : Math.max(-1, i - 100); i != e; i+=d) { | ||
| + for (var i = cur.line, found, e = forward ? Math.min(i + maxScanLines, cm.lineCount()) : Math.max(-1, i - maxScanLines); i != e; i+=d) { | ||
| if (i == cur.line) found = scan(line, i, pos); | ||
| else found = scan(cm.getLineHandle(i), i); | ||
| if (found) break; | ||
View
8
addon/fold/foldgutter.js
| @@ -88,14 +88,14 @@ | ||
| } | ||
| function onChange(cm) { | ||
| - var state = cm.state.foldGutter; | ||
| + var state = cm.state.foldGutter, opts = cm.state.foldGutter.options; | ||
| state.from = state.to = 0; | ||
| clearTimeout(state.changeUpdate); | ||
| - state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, 600); | ||
| + state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600); | ||
| } | ||
| function onViewportChange(cm) { | ||
| - var state = cm.state.foldGutter; | ||
| + var state = cm.state.foldGutter, opts = cm.state.foldGutter.options; | ||
| clearTimeout(state.changeUpdate); | ||
| state.changeUpdate = setTimeout(function() { | ||
| var vp = cm.getViewport(); | ||
| @@ -113,7 +113,7 @@ | ||
| } | ||
| }); | ||
| } | ||
| - }, 400); | ||
| + }, opts.updateViewportTimeSpan || 400); | ||
| } | ||
| function onFold(cm, from) { | ||
View
46
addon/fold/indent-fold.js
| @@ -1,26 +1,30 @@ | ||
| CodeMirror.registerHelper("fold", "indent", function(cm, start) { | ||
| - var lastLine = cm.lastLine(), | ||
| - tabSize = cm.getOption("tabSize"), | ||
| - firstLine = cm.getLine(start.line), | ||
| - myIndent = CodeMirror.countColumn(firstLine, null, tabSize); | ||
| - | ||
| - function foldEnded(curColumn, prevColumn) { | ||
| - return curColumn < myIndent || | ||
| - (curColumn == myIndent && prevColumn >= myIndent) || | ||
| - (curColumn > myIndent && i == lastLine); | ||
| - } | ||
| - | ||
| - for (var i = start.line + 1; i <= lastLine; i++) { | ||
| - var curColumn = CodeMirror.countColumn(cm.getLine(i), null, tabSize); | ||
| - var prevColumn = CodeMirror.countColumn(cm.getLine(i-1), null, tabSize); | ||
| - | ||
| - if (foldEnded(curColumn, prevColumn)) { | ||
| - var lastFoldLineNumber = curColumn > myIndent && i == lastLine ? i : i-1; | ||
| - var lastFoldLine = cm.getLine(lastFoldLineNumber); | ||
| - return {from: CodeMirror.Pos(start.line, firstLine.length), | ||
| - to: CodeMirror.Pos(lastFoldLineNumber, lastFoldLine.length)}; | ||
| + var tabSize = cm.getOption("tabSize"), firstLine = cm.getLine(start.line); | ||
| + if (!/\S/.test(firstLine)) return; | ||
| + var getIndent = function(lineNum) { | ||
| + return CodeMirror.countColumn(lineNum, null, tabSize); | ||
| + }; | ||
| + var myIndent = getIndent(firstLine); | ||
| + var lastLineInFold = null; | ||
| + // Go through lines until we find a line that definitely doesn't belong in | ||
| + // the block we're folding, or to the end. | ||
| + for (var i = start.line + 1, end = cm.lastLine(); i <= end; ++i) { | ||
| + var curLine = cm.getLine(i); | ||
| + var curIndent = getIndent(curLine); | ||
| + if (curIndent > myIndent) { | ||
| + // Lines with a greater indent are considered part of the block. | ||
| + lastLineInFold = i; | ||
| + } else if (!/\S/.test(curLine)) { | ||
| + // Empty lines might be breaks within the block we're trying to fold. | ||
| + } else { | ||
| + // A non-empty line at an indent equal to or less than ours marks the | ||
| + // start of another block. | ||
| + break; | ||
| } | ||
| } | ||
| + if (lastLineInFold) return { | ||
| + from: CodeMirror.Pos(start.line, firstLine.length), | ||
| + to: CodeMirror.Pos(lastLineInFold, cm.getLine(lastLineInFold).length) | ||
| + }; | ||
| }); | ||
| - | ||
| CodeMirror.indentRangeFinder = CodeMirror.fold.indent; // deprecated |
View
1
addon/hint/javascript-hint.js
| @@ -21,6 +21,7 @@ | ||
| function scriptHint(editor, keywords, getToken, options) { | ||
| // Find the token at the cursor | ||
| var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token; | ||
| + if (/\b(?:string|comment)\b/.test(token.type)) return; | ||
| token.state = CodeMirror.innerMode(editor.getMode(), token.state).state; | ||
| // If it's not a 'word-style' token, ignore the token. | ||
View
28
addon/hint/show-hint.js
| @@ -1,6 +1,9 @@ | ||
| (function() { | ||
| "use strict"; | ||
| + var HINT_ELEMENT_CLASS = "CodeMirror-hint"; | ||
| + var ACTIVE_HINT_ELEMENT_CLASS = "CodeMirror-hint-active"; | ||
| + | ||
| CodeMirror.showHint = function(cm, getHints, options) { | ||
| // We want a single cursor position. | ||
| if (cm.somethingSelected()) return; | ||
| @@ -140,19 +143,26 @@ | ||
| return ourMap; | ||
| } | ||
| + function getHintElement(stopAt, el) { | ||
| + while (el && el != stopAt) { | ||
| + if (el.nodeName.toUpperCase() === "LI") return el; | ||
| + el = el.parentNode; | ||
| + } | ||
| + } | ||
| + | ||
| function Widget(completion, data) { | ||
| this.completion = completion; | ||
| this.data = data; | ||
| var widget = this, cm = completion.cm, options = completion.options; | ||
| var hints = this.hints = document.createElement("ul"); | ||
| hints.className = "CodeMirror-hints"; | ||
| - this.selectedHint = 0; | ||
| + this.selectedHint = options.getDefaultSelection ? options.getDefaultSelection(cm,options,data) : 0; | ||
| var completions = data.list; | ||
| for (var i = 0; i < completions.length; ++i) { | ||
| var elt = hints.appendChild(document.createElement("li")), cur = completions[i]; | ||
| - var className = "CodeMirror-hint" + (i ? "" : " CodeMirror-hint-active"); | ||
| + var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS); | ||
| if (cur.className != null) className = cur.className + " " + className; | ||
| elt.className = className; | ||
| if (cur.render) cur.render(elt, data, cur); | ||
| @@ -216,13 +226,15 @@ | ||
| }); | ||
| CodeMirror.on(hints, "dblclick", function(e) { | ||
| - var t = e.target || e.srcElement; | ||
| - if (t.hintId != null) {widget.changeActive(t.hintId); widget.pick();} | ||
| + var t = getHintElement(hints, e.target || e.srcElement); | ||
| + if (t && t.hintId != null) {widget.changeActive(t.hintId); widget.pick();} | ||
| }); | ||
| + | ||
| CodeMirror.on(hints, "click", function(e) { | ||
| - var t = e.target || e.srcElement; | ||
| - if (t.hintId != null) widget.changeActive(t.hintId); | ||
| + var t = getHintElement(hints, e.target || e.srcElement); | ||
| + if (t && t.hintId != null) widget.changeActive(t.hintId); | ||
| }); | ||
| + | ||
| CodeMirror.on(hints, "mousedown", function() { | ||
| setTimeout(function(){cm.focus();}, 20); | ||
| }); | ||
| @@ -257,9 +269,9 @@ | ||
| i = avoidWrap ? 0 : this.data.list.length - 1; | ||
| if (this.selectedHint == i) return; | ||
| var node = this.hints.childNodes[this.selectedHint]; | ||
| - node.className = node.className.replace(" CodeMirror-hint-active", ""); | ||
| + node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, ""); | ||
| node = this.hints.childNodes[this.selectedHint = i]; | ||
| - node.className += " CodeMirror-hint-active"; | ||
| + node.className += " " + ACTIVE_HINT_ELEMENT_CLASS; | ||
| if (node.offsetTop < this.hints.scrollTop) | ||
| this.hints.scrollTop = node.offsetTop - 3; | ||
| else if (node.offsetTop + node.offsetHeight > this.hints.scrollTop + this.hints.clientHeight) | ||
View
14
addon/tern/tern.js
| @@ -96,7 +96,7 @@ | ||
| getHint: function(cm, c) { return hint(this, cm, c); }, | ||
| - showType: function(cm) { showType(this, cm); }, | ||
| + showType: function(cm, pos) { showType(this, cm, pos); }, | ||
| updateArgHints: function(cm) { updateArgHints(this, cm); }, | ||
| @@ -106,10 +106,10 @@ | ||
| rename: function(cm) { rename(this, cm); }, | ||
| - request: function (cm, query, c) { | ||
| + request: function (cm, query, c, pos) { | ||
| var self = this; | ||
| var doc = findDoc(this, cm.getDoc()); | ||
| - var request = buildRequest(this, doc, query); | ||
| + var request = buildRequest(this, doc, query, pos); | ||
| this.server.request(request, function (error, data) { | ||
| if (!error && self.options.responseFilter) | ||
| @@ -221,7 +221,7 @@ | ||
| // Type queries | ||
| - function showType(ts, cm) { | ||
| + function showType(ts, cm, pos) { | ||
| ts.request(cm, "type", function(error, data) { | ||
| if (error) return showError(ts, cm, error); | ||
| if (ts.options.typeTip) { | ||
| @@ -236,7 +236,7 @@ | ||
| } | ||
| } | ||
| tempTooltip(cm, tip); | ||
| - }); | ||
| + }, pos); | ||
| } | ||
| // Maintaining argument hints | ||
| @@ -450,13 +450,13 @@ | ||
| // Generic request-building helper | ||
| - function buildRequest(ts, doc, query) { | ||
| + function buildRequest(ts, doc, query, pos) { | ||
| var files = [], offsetLines = 0, allowFragments = !query.fullDocs; | ||
| if (!allowFragments) delete query.fullDocs; | ||
| if (typeof query == "string") query = {type: query}; | ||
| query.lineCharPositions = true; | ||
| if (query.end == null) { | ||
| - query.end = doc.doc.getCursor("end"); | ||
| + query.end = pos || doc.doc.getCursor("end"); | ||
| if (doc.doc.somethingSelected()) | ||
| query.start = doc.doc.getCursor("start"); | ||
| } | ||
View
1
demo/tern.html
| @@ -16,6 +16,7 @@ | ||
| <script src="http://marijnhaverbeke.nl/acorn/acorn.js"></script> | ||
| <script src="http://marijnhaverbeke.nl/acorn/acorn_loose.js"></script> | ||
| <script src="http://marijnhaverbeke.nl/acorn/util/walk.js"></script> | ||
| +<script src="http://ternjs.net/doc/demo/polyfill.js"></script> | ||
| <script src="http://ternjs.net/lib/signal.js"></script> | ||
| <script src="http://ternjs.net/lib/tern.js"></script> | ||
| <script src="http://ternjs.net/lib/def.js"></script> | ||
Oops, something went wrong.
Showing you all comments on commits in this comparison.
|
One minor issue with this fix is that in the case where we just want to move the selection, it still marks the document as dirty even though there's no apparent change. Would it make sense to keep the original |
|
That's a good point. Try dcf0b65 |