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
9
contributors
Commits on Dec 29, 2014
|
|
ankitstarski + marijnh |
[sass mode] Improve indentation
Fixes bug #2156 for the most part indention was bugged because it was reaching a wrong state when any text that was not in the known set of words or patterns was incurred. for eg: head | <---- cursor should be here and lets take color : red as another example now 'red' is same to the current tokenizer as 'head' from the first example. So it indents for red automatically. It was fixed by not letting any text after colon to reach the state where it appends an indent after it. |
2fc14db
|
Commits on Dec 31, 2014
|
|
mightyguava |
[vim] Support showing search matches on scrollbar
|
66f9224
|
Commits on Jan 01, 2015
|
|
mightyguava |
[vim] Enable clearing search scrollbar annotation
|
d0a2dda
|
Commits on Jan 02, 2015
|
|
ankitstarski + marijnh |
[sass mode] Fixed bug #2156 and syntax highlighting too
To fix this I had to introduce new state parameter that tells if cursor is before colon or not. |
9e56052
|
|||
|
|
marijnh |
[merge addon] Keep stable scroll position when removing/adding alignm…
|
1bfa666
|
Commits on Jan 03, 2015
|
|
marijnh |
[simpelscrollbars addon] Properly detect end-of-drag on non-Webkit br…
…owsers Issue #3017 |
0d8d855
|
|||
|
|
sapphire-al2o3 + marijnh |
[clike mode] Fix GLSL keywords
|
5619d83
|
Commits on Jan 04, 2015
|
|
mightyguava |
[vim] Check for falsy return from CodeMirror.keyname
|
f97df90
|
Commits on Jan 05, 2015
Commits on Jan 07, 2015
|
|
marijnh |
Don't fall back to native implemtation of map/indexOf
They aren't faster, and don't work on pseudo-arrays. |
9ee2cef
|
Commits on Jan 09, 2015
Commits on Jan 12, 2015
|
|
marijnh |
[foldgutter addon] Use same option defaulting strategy as foldcode addon
|
6d8de27
|
Commits on Jan 13, 2015
|
|
marijnh |
[closetag addon] Define a closeTag command that closes the nearest op…
…en tag Closes #3028 |
f12f573
|
|||
|
|
silverwind + marijnh |
[meta] Add findModeByFileName, several meta improvements
|
78e06ac
|
Commits on Jan 14, 2015
|
|
marijnh |
Use blint for linting, rather than in-tree tool
(Blint is the in-tree tool factored into its own npm package.) |
643d9c0
|
|||
|
|
marijnh |
Try to please Travis by declaring blint dep differently
|
509b989
|
|||
|
|
marijnh |
Require node 0.10 in .travis.yml
|
e53166b
|
Commits on Jan 17, 2015
Commits on Jan 19, 2015
|
|
vincentwoo + marijnh |
[perl] Add lineComment attribute to Perl mode
Also clean up style a bit. `perl.js` is oddly spaced! |
5a7affd
|
|||
|
|
marijnh |
Work around bad measuring in Webkit for text-rendering: optimizelegib…
|
6534d9e
|
Commits on Jan 22, 2015
Unified
Split
Showing
with
512 additions
and 2,463 deletions.
- +1 −1 .travis.yml
- +4 −0 AUTHORS
- +14 −7 addon/edit/closetag.js
- +4 −0 addon/fold/foldcode.js
- +4 −2 addon/fold/foldgutter.js
- +5 −1 addon/merge/merge.js
- +1 −1 addon/mode/simple.js
- +6 −4 addon/scroll/simplescrollbars.js
- +95 −0 addon/selection/selection-pointer.js
- +1 −14 bin/lint
- +1 −1 bower.json
- +5 −0 demo/simplemode.html
- +1 −0 doc/compress.html
- +27 −10 doc/manual.html
- +20 −0 doc/releases.html
- +1 −1 index.html
- +1 −0 keymap/emacs.js
- +22 −3 keymap/vim.js
- +31 −15 lib/codemirror.js
- +4 −4 mode/clike/clike.js
- +2 −2 mode/css/css.js
- +5 −1 mode/htmlmixed/index.html
- +7 −1 mode/javascript/javascript.js
- +26 −15 mode/meta.js
- +15 −10 mode/perl/perl.js
- +186 −99 mode/sass/sass.js
- +3 −2 package.json
- +11 −0 test/lint.js
- +0 −1,782 test/lint/acorn.js
- +0 −166 test/lint/lint.js
- +0 −313 test/lint/walk.js
- +1 −8 test/run.js
- +8 −0 test/test.js
View
2
.travis.yml
| @@ -1,3 +1,3 @@ | ||
| language: node_js | ||
| node_js: | ||
| - - 0.8 | ||
| + - 0.10 |
View
4
AUTHORS
| @@ -43,6 +43,7 @@ Andy Kimball | ||
| Andy Li | ||
| angelozerr | ||
| angelo.zerr@gmail.com | ||
| +Ankit | ||
| Ankit Ahuja | ||
| Ansel Santosa | ||
| Anthony Grimes | ||
| @@ -138,6 +139,7 @@ flack | ||
| ForbesLindesay | ||
| Forbes Lindesay | ||
| Ford_Lawnmower | ||
| +Forrest Oliphant | ||
| Frank Wiegand | ||
| Gabriel Gheorghian | ||
| Gabriel Horner | ||
| @@ -256,6 +258,7 @@ Marcel Gerber | ||
| Marco Aurélio | ||
| Marco Munizaga | ||
| Marcus Bointon | ||
| +Marek Rudnicki | ||
| Marijn Haverbeke | ||
| Mário Gonçalves | ||
| Mario Pietsch | ||
| @@ -383,6 +386,7 @@ stoskov | ||
| Taha Jahangir | ||
| Takuji Shimokawa | ||
| Tarmil | ||
| +tel | ||
| tfjgeorge | ||
| Thaddee Tyl | ||
| TheHowl | ||
View
21
addon/edit/closetag.js
| @@ -94,32 +94,32 @@ | ||
| } | ||
| } | ||
| - function autoCloseSlash(cm) { | ||
| - if (cm.getOption("disableInput")) return CodeMirror.Pass; | ||
| + function autoCloseCurrent(cm, typingSlash) { | ||
| var ranges = cm.listSelections(), replacements = []; | ||
| + var head = typingSlash ? "/" : "</"; | ||
| for (var i = 0; i < ranges.length; i++) { | ||
| if (!ranges[i].empty()) return CodeMirror.Pass; | ||
| var pos = ranges[i].head, tok = cm.getTokenAt(pos); | ||
| var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state; | ||
| - if (tok.type == "string" || tok.string.charAt(0) != "<" || | ||
| - tok.start != pos.ch - 1) | ||
| + if (typingSlash && (tok.type == "string" || tok.string.charAt(0) != "<" || | ||
| + tok.start != pos.ch - 1)) | ||
| return CodeMirror.Pass; | ||
| // Kludge to get around the fact that we are not in XML mode | ||
| // when completing in JS/CSS snippet in htmlmixed mode. Does not | ||
| // work for other XML embedded languages (there is no general | ||
| // way to go from a mixed mode to its current XML state). | ||
| if (inner.mode.name != "xml") { | ||
| if (cm.getMode().name == "htmlmixed" && inner.mode.name == "javascript") | ||
| - replacements[i] = "/script>"; | ||
| + replacements[i] = head + "script>"; | ||
| else if (cm.getMode().name == "htmlmixed" && inner.mode.name == "css") | ||
| - replacements[i] = "/style>"; | ||
| + replacements[i] = head + "style>"; | ||
| else | ||
| return CodeMirror.Pass; | ||
| } else { | ||
| if (!state.context || !state.context.tagName || | ||
| closingTagExists(cm, state.context.tagName, pos, state)) | ||
| return CodeMirror.Pass; | ||
| - replacements[i] = "/" + state.context.tagName + ">"; | ||
| + replacements[i] = head + state.context.tagName + ">"; | ||
| } | ||
| } | ||
| cm.replaceSelections(replacements); | ||
| @@ -129,6 +129,13 @@ | ||
| cm.indentLine(ranges[i].head.line); | ||
| } | ||
| + function autoCloseSlash(cm) { | ||
| + if (cm.getOption("disableInput")) return CodeMirror.Pass; | ||
| + autoCloseCurrent(cm, true); | ||
| + } | ||
| + | ||
| + CodeMirror.commands.closeTag = function(cm) { return autoCloseCurrent(cm); }; | ||
| + | ||
| function indexOf(collection, elt) { | ||
| if (collection.indexOf) return collection.indexOf(elt); | ||
| for (var i = 0, e = collection.length; i < e; ++i) | ||
View
4
addon/fold/foldcode.js
| @@ -142,4 +142,8 @@ | ||
| return editorOptions[name]; | ||
| return defaultOptions[name]; | ||
| } | ||
| + | ||
| + CodeMirror.defineExtension("foldOption", function(options, name) { | ||
| + return getOption(this, options, name); | ||
| + }); | ||
| }); | ||
View
6
addon/fold/foldgutter.js
| @@ -67,14 +67,16 @@ | ||
| function updateFoldInfo(cm, from, to) { | ||
| var opts = cm.state.foldGutter.options, cur = from; | ||
| + var minSize = cm.foldOption(opts, "minFoldSize"); | ||
| + var func = cm.foldOption(opts, "rangeFinder"); | ||
| cm.eachLine(from, to, function(line) { | ||
| var mark = null; | ||
| if (isFolded(cm, cur)) { | ||
| mark = marker(opts.indicatorFolded); | ||
| } else { | ||
| - var pos = Pos(cur, 0), func = opts.rangeFinder || CodeMirror.fold.auto; | ||
| + var pos = Pos(cur, 0); | ||
| var range = func && func(cm, pos); | ||
| - if (range && range.from.line + 1 < range.to.line) | ||
| + if (range && range.to.line - range.from.line >= minSize) | ||
| mark = marker(opts.indicatorOpen); | ||
| } | ||
| cm.setGutterMarker(line, opts.gutter, mark); | ||
View
6
addon/merge/merge.js
| @@ -259,11 +259,13 @@ | ||
| function makeConnections(dv) { | ||
| if (!dv.showDifferences) return; | ||
| - var align = dv.mv.options.connect == "align"; | ||
| + var align = dv.mv.options.connect == "align", oldScrollEdit, oldScrollOrig; | ||
| if (align) { | ||
| if (!dv.orig.curOp) return dv.orig.operation(function() { | ||
| makeConnections(dv); | ||
| }); | ||
| + oldScrollEdit = dv.edit.getScrollInfo().top; | ||
| + oldScrollOrig = dv.orig.getScrollInfo().top; | ||
| for (var i = 0; i < dv.aligners.length; i++) | ||
| dv.aligners[i].clear(); | ||
| dv.aligners.length = 0; | ||
| @@ -293,6 +295,8 @@ | ||
| dv.aligners.push(padBelow(dv.edit, 0, extraSpaceAbove.edit)); | ||
| if (extraSpaceAbove.orig) | ||
| dv.aligners.push(padBelow(dv.orig, 0, extraSpaceAbove.orig)); | ||
| + dv.edit.scrollTo(null, oldScrollEdit); | ||
| + dv.orig.scrollTo(null, oldScrollOrig); | ||
| } | ||
| } | ||
View
2
addon/mode/simple.js
| @@ -116,7 +116,7 @@ | ||
| var curState = states[state.state]; | ||
| for (var i = 0; i < curState.length; i++) { | ||
| var rule = curState[i]; | ||
| - var matches = stream.match(rule.regex); | ||
| + var matches = (!rule.data.sol || stream.sol()) && stream.match(rule.regex); | ||
| if (matches) { | ||
| if (rule.data.next) { | ||
| state.state = rule.data.next; | ||
View
10
addon/scroll/simplescrollbars.js
| @@ -27,14 +27,16 @@ | ||
| CodeMirror.e_preventDefault(e); | ||
| var axis = self.orientation == "horizontal" ? "pageX" : "pageY"; | ||
| var start = e[axis], startpos = self.pos; | ||
| + function done() { | ||
| + CodeMirror.off(document, "mousemove", move); | ||
| + CodeMirror.off(document, "mouseup", done); | ||
| + } | ||
| function move(e) { | ||
| - if (e.which != 1) { | ||
| - CodeMirror.off(document, "mousemove", move); | ||
| - return; | ||
| - } | ||
| + if (e.which != 1) return done(); | ||
| self.moveTo(startpos + (e[axis] - start) * (self.total / self.size)); | ||
| } | ||
| CodeMirror.on(document, "mousemove", move); | ||
| + CodeMirror.on(document, "mouseup", done); | ||
| }); | ||
| CodeMirror.on(this.node, "click", function(e) { | ||
View
95
addon/selection/selection-pointer.js
| @@ -0,0 +1,95 @@ | ||
| +// CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
| +// Distributed under an MIT license: http://codemirror.net/LICENSE | ||
| + | ||
| +(function(mod) { | ||
| + if (typeof exports == "object" && typeof module == "object") // CommonJS | ||
| + mod(require("../../lib/codemirror")); | ||
| + else if (typeof define == "function" && define.amd) // AMD | ||
| + define(["../../lib/codemirror"], mod); | ||
| + else // Plain browser env | ||
| + mod(CodeMirror); | ||
| +})(function(CodeMirror) { | ||
| + "use strict"; | ||
| + | ||
| + CodeMirror.defineOption("selectionPointer", false, function(cm, val) { | ||
| + var data = cm.state.selectionPointer; | ||
| + if (data) { | ||
| + CodeMirror.off(cm.getWrapperElement(), "mousemove", data.mousemove); | ||
| + CodeMirror.off(cm.getWrapperElement(), "mouseout", data.mouseout); | ||
| + cm.off("cursorActivity", reset); | ||
| + cm.off("scroll", reset); | ||
| + cm.state.selectionPointer = null; | ||
| + cm.display.lineDiv.style.cursor = ""; | ||
| + } | ||
| + if (val) { | ||
| + data = cm.state.selectionPointer = { | ||
| + value: typeof val == "string" ? val : "default", | ||
| + mousemove: function(event) { mousemove(cm, event); }, | ||
| + mouseout: function(event) { mouseout(cm, event); }, | ||
| + rects: null, | ||
| + mouseX: null, mouseY: null, | ||
| + willUpdate: false | ||
| + }; | ||
| + CodeMirror.on(cm.getWrapperElement(), "mousemove", data.mousemove); | ||
| + CodeMirror.on(cm.getWrapperElement(), "mouseout", data.mouseout); | ||
| + cm.on("cursorActivity", reset); | ||
| + cm.on("scroll", reset); | ||
| + } | ||
| + }); | ||
| + | ||
| + function mousemove(cm, event) { | ||
| + var data = cm.state.selectionPointer; | ||
| + if (event.buttons == null ? event.which : event.buttons) { | ||
| + data.mouseX = data.mouseY = null; | ||
| + } else { | ||
| + data.mouseX = event.clientX; | ||
| + data.mouseY = event.clientY; | ||
| + } | ||
| + scheduleUpdate(cm); | ||
| + } | ||
| + | ||
| + function mouseout(cm, event) { | ||
| + if (!cm.getWrapperElement().contains(event.relatedTarget)) { | ||
| + var data = cm.state.selectionPointer; | ||
| + data.mouseX = data.mouseY = null; | ||
| + scheduleUpdate(cm); | ||
| + } | ||
| + } | ||
| + | ||
| + function reset(cm) { | ||
| + cm.state.selectionPointer.rects = null; | ||
| + scheduleUpdate(cm); | ||
| + } | ||
| + | ||
| + function scheduleUpdate(cm) { | ||
| + if (!cm.state.selectionPointer.willUpdate) { | ||
| + cm.state.selectionPointer.willUpdate = true; | ||
| + setTimeout(function() { | ||
| + update(cm); | ||
| + cm.state.selectionPointer.willUpdate = false; | ||
| + }, 50); | ||
| + } | ||
| + } | ||
| + | ||
| + function update(cm) { | ||
| + var data = cm.state.selectionPointer; | ||
| + if (!data) return; | ||
| + if (data.rects == null && data.mouseX != null) { | ||
| + data.rects = []; | ||
| + if (cm.somethingSelected()) { | ||
| + for (var sel = cm.display.selectionDiv.firstChild; sel; sel = sel.nextSibling) | ||
| + data.rects.push(sel.getBoundingClientRect()); | ||
| + } | ||
| + } | ||
| + var inside = false; | ||
| + if (data.mouseX != null) for (var i = 0; i < data.rects.length; i++) { | ||
| + var rect = data.rects[i]; | ||
| + if (rect.left <= data.mouseX && rect.right >= data.mouseX && | ||
| + rect.top <= data.mouseY && rect.bottom >= data.mouseY) | ||
| + inside = true; | ||
| + } | ||
| + var cursor = inside ? data.value : ""; | ||
| + if (cm.display.lineDiv.style.cursor != cursor) | ||
| + cm.display.lineDiv.style.cursor = cursor; | ||
| + } | ||
| +}); |
View
15
bin/lint
| @@ -1,16 +1,3 @@ | ||
| #!/usr/bin/env node | ||
| -var lint = require("../test/lint/lint"), | ||
| - path = require("path"); | ||
| - | ||
| -if (process.argv.length > 2) { | ||
| - lint.checkDir(process.argv[2]); | ||
| -} else { | ||
| - process.chdir(path.resolve(__dirname, "..")); | ||
| - lint.checkDir("lib"); | ||
| - lint.checkDir("mode"); | ||
| - lint.checkDir("addon"); | ||
| - lint.checkDir("keymap"); | ||
| -} | ||
| - | ||
| -process.exit(lint.success() ? 0 : 1); | ||
| +process.exit(require("../test/lint").ok ? 0 : 1); |
View
2
bower.json
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "codemirror", | ||
| - "version":"4.11.0", | ||
| + "version":"4.12.0", | ||
| "main": ["lib/codemirror.js", "lib/codemirror.css"], | ||
| "ignore": [ | ||
| "**/.*", | ||
View
5
demo/simplemode.html
| @@ -74,6 +74,11 @@ | ||
| string (since JS provides no way to find out where a group matched), | ||
| and this property must hold an array of token styles that has one | ||
| style for each matched group.</dd> | ||
| + <dt><code><strong>sol</strong></code>: boolean</dt> | ||
| + <dd>When true, this token will only match at the start of the line. | ||
| + (The <code>^</code> regexp marker doesn't work as you'd expect in | ||
| + this context because of limitations in JavaScript's RegExp | ||
| + API.)</dd> | ||
| <dt><code><strong>next</strong>: string</code></dt> | ||
| <dd>When a <code>next</code> property is present, the mode will | ||
| transfer to the state named by the property when the token is | ||
View
1
doc/compress.html
| @@ -36,6 +36,7 @@ | ||
| <input type="hidden" id="download" name="download" value="codemirror-compressed.js"/> | ||
| <p>Version: <select id="version" onchange="setVersion(this);" style="padding: 1px;"> | ||
| <option value="http://codemirror.net/">HEAD</option> | ||
| + <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=4.12.0;f=">4.12</option> | ||
| <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=4.11.0;f=">4.11</option> | ||
| <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=4.10.0;f=">4.10</option> | ||
| <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=4.9.0;f=">4.9</option> | ||
View
37
doc/manual.html
| @@ -63,7 +63,7 @@ | ||
| <section class=first id=overview> | ||
| <h2 style="position: relative"> | ||
| User manual and reference guide | ||
| - <span style="color: #888; font-size: 1rem; position: absolute; right: 0; bottom: 0">version 4.11.0</span> | ||
| + <span style="color: #888; font-size: 1rem; position: absolute; right: 0; bottom: 0">version 4.12.0</span> | ||
| </h2> | ||
| <p>CodeMirror is a code-editor component that can be embedded in | ||
| @@ -1763,9 +1763,12 @@ <h3 id="api_sizing">Sizing, scrolling and positioning methods</h3> | ||
| If <code>mode</code> is <code>"local"</code>, they will be | ||
| relative to the top-left corner of the editable document. If it | ||
| is <code>"page"</code> or not given, they are relative to the | ||
| - top-left corner of the page. <code>where</code> can be a boolean | ||
| - indicating whether you want the start (<code>true</code>) or the | ||
| - end (<code>false</code>) of the selection, or, if a <code>{line, | ||
| + top-left corner of the page. If <code>mode</code> | ||
| + is <code>"window"</code>, the coordinates are relative to the | ||
| + top-left corner of the currently visible (scrolled) | ||
| + window. <code>where</code> can be a boolean indicating whether | ||
| + you want the start (<code>true</code>) or the end | ||
| + (<code>false</code>) of the selection, or, if a <code>{line, | ||
| ch}</code> object is given, it specifies the precise position at | ||
| which you want to measure.</dd> | ||
| <dt id="charCoords"><code><strong>cm.charCoords</strong>(pos: {line, ch}, ?mode: string) → {left, right, top, bottom}</code></dt> | ||
| @@ -2229,8 +2232,12 @@ <h2 id="addons">Addons</h2> | ||
| squiggly underline style for this class.</dd> | ||
| <dt id="addon_closetag"><a href="../addon/edit/closetag.js"><code>edit/closetag.js</code></a></dt> | ||
| - <dd>Provides utility functions for adding automatic tag closing | ||
| - to XML modes. See | ||
| + <dd>Defines an <code>autoCloseTags</code> option that will | ||
| + auto-close XML tags when '<code>></code>' or '<code>/</code>' | ||
| + is typed, and | ||
| + a <code>closeTag</code> <a href="#commands">command</a> that | ||
| + closes the nearest open tag. Depends on | ||
| + the <code>fold/xml-fold.js</code> addon. See | ||
| the <a href="../demo/closetag.html">demo</a>.</dd> | ||
| <dt id="addon_continuelist"><a href="../addon/edit/continuelist.js"><code>edit/continuelist.js</code></a></dt> | ||
| @@ -2605,6 +2612,7 @@ <h2 id="addons">Addons</h2> | ||
| with pluggable warning sources | ||
| (see <a href="../addon/lint/json-lint.js"><code>json-lint.js</code></a>, | ||
| <a href="../addon/lint/javascript-lint.js"><code>javascript-lint.js</code></a>, | ||
| + <a href="../addon/lint/coffeescript-lint.js"><code>coffeescript-lint.js</code></a>, | ||
| and <a href="../addon/lint/css-lint.js"><code>css-lint.js</code></a> | ||
| in the same directory). Defines a <code>lint</code> option that | ||
| can be set to a warning source (for | ||
| @@ -2627,6 +2635,14 @@ <h2 id="addons">Addons</h2> | ||
| and adds a background with the class <code>CodeMirror-activeline-background</code>. | ||
| is enabled. See the <a href="../demo/activeline.html">demo</a>.</dd> | ||
| + <dt id="addon_selection-pointer"><a href="../addon/selection/selection-pointer.js"><code>selection/selection-pointer.js</code></a></dt> | ||
| + <dd>Defines a <code>selectionPointer</code> option which you can | ||
| + use to control the mouse cursor appearance when hovering over | ||
| + the selection. It can be set to a string, | ||
| + like <code>"pointer"</code>, or to true, in which case | ||
| + the <code>"default"</code> (arrow) cursor will be used. You can | ||
| + see a demo <a href="../mode/htmlmixed/index.html">here</a>.</dd> | ||
| + | ||
| <dt id="addon_loadmode"><a href="../addon/mode/loadmode.js"><code>mode/loadmode.js</code></a></dt> | ||
| <dd>Defines a <code>CodeMirror.requireMode(modename, | ||
| callback)</code> function that will try to load a given mode and | ||
| @@ -2651,12 +2667,13 @@ <h2 id="addons">Addons</h2> | ||
| properties <code>mimes</code>, which holds an array of MIME | ||
| types for modes with multiple MIMEs associated, | ||
| and <code>ext</code>, which holds an array of file extensions | ||
| - associated with this mode. Three convenience | ||
| + associated with this mode. Four convenience | ||
| functions, <code>CodeMirror.findModeByMIME</code>, | ||
| - and <code>CodeMirror.findModeByExtension</code>, | ||
| + <code>CodeMirror.findModeByExtension</code>, | ||
| + <code>CodeMirror.findModeByFileName</code> | ||
| and <code>CodeMirror.findModeByName</code> are provided, which | ||
| - return such an object given a MIME or extension string. Note | ||
| - that, for historical reasons, this file resides in the | ||
| + return such an object given a MIME, extension, file name or mode name | ||
| + string. Note that, for historical reasons, this file resides in the | ||
| top-level <code>mode</code> directory, not | ||
| under <code>addon</code>. <a href="../demo/loadmode.html">Demo</a>.</dd> | ||
Oops, something went wrong.