Commit 66b28c45 authored by Jérome Perrin's avatar Jérome Perrin

codemirror: update to 5.13.4

I used this procedure :

git clone https://github.com/codemirror/CodeMirror.git --branch 5.13.4
cd CodeMirror

find . -not -path "./.git*" -type f -exec sed -i 's/addon\/edit\//addon\/cm_edit\//g' {} +
git mv addon/edit addon/cm_edit
git commit -a -m "ERP5: rename addon/edit -> addon/cm_edit"

lftp http://login:password@172.17.0.2:2200/erp5/portal_skins/erp5_code_mirror/ -e 'rm -rf codemirror ; mkdir codemirror ; quit' &&\
lftp http://login:password@172.17.0.2:2200/erp5/portal_skins/erp5_code_mirror/codemirror/ -e 'mkdir addon ; mput -d * */* */*/* */*/*/* ; quit '

(cherry picked from commit 639c0d5a)
parent 40a74e1b
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="DTMLMethod" module="OFS.DTMLMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>.gitattributes</string> </value>
</item>
<item>
<key> <string>_vars</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>globals</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>raw</string> </key>
<value> <string>*.txt text\n
*.js text\n
*.html text\n
*.md text\n
*.json text\n
*.yml text\n
*.css text\n
*.svg text\n
</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="DTMLMethod" module="OFS.DTMLMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>.gitignore</string> </value>
</item>
<item>
<key> <string>_vars</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>globals</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>raw</string> </key>
<value> <string>/node_modules\n
/npm-debug.log\n
test.html\n
.tern-*\n
*~\n
*.swp\n
.idea\n
*.iml\n
</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -50,6 +50,11 @@ Alexander Solovyov\n ...@@ -50,6 +50,11 @@ Alexander Solovyov\n
Alexandre Bique\n Alexandre Bique\n
alexey-k\n alexey-k\n
Alex Piggott\n Alex Piggott\n
Aliaksei Chapyzhenka\n
Allen Sarkisyan\n
Amin Shali\n
Amin Ullah Khan\n
amshali@google.com\n
Amsul\n Amsul\n
amuntean\n amuntean\n
Amy\n Amy\n
...@@ -58,8 +63,10 @@ anaran\n ...@@ -58,8 +63,10 @@ anaran\n
AndersMad\n AndersMad\n
Anders Nawroth\n Anders Nawroth\n
Anderson Mesquita\n Anderson Mesquita\n
Anders Wåglund\n
Andrea G\n Andrea G\n
Andreas Reischuck\n Andreas Reischuck\n
Andres Taylor\n
Andre von Houck\n Andre von Houck\n
Andrey Fedorov\n Andrey Fedorov\n
Andrey Klyuchnikov\n Andrey Klyuchnikov\n
...@@ -67,23 +74,34 @@ Andrey Lushnikov\n ...@@ -67,23 +74,34 @@ Andrey Lushnikov\n
Andy Joslin\n Andy Joslin\n
Andy Kimball\n Andy Kimball\n
Andy Li\n Andy Li\n
Angelo\n
angelozerr\n angelozerr\n
angelo.zerr@gmail.com\n angelo.zerr@gmail.com\n
Ankit\n
Ankit Ahuja\n Ankit Ahuja\n
Ansel Santosa\n Ansel Santosa\n
Anthony Dugois\n
anthonygego\n
Anthony Gégo\n
Anthony Grimes\n Anthony Grimes\n
Anton Kovalyov\n Anton Kovalyov\n
AQNOUCH Mohammed\n
areos\n areos\n
Arnab Bose\n
as3boyan\n as3boyan\n
AtomicPages LLC\n AtomicPages LLC\n
Atul Bhouraskar\n Atul Bhouraskar\n
Aurelian Oancea\n Aurelian Oancea\n
Barret Rennie\n
Basarat Ali Syed\n
Bastian Müller\n Bastian Müller\n
belhaj\n
Bem Jones-Bey\n Bem Jones-Bey\n
benbro\n benbro\n
Beni Cherniavsky-Paskin\n Beni Cherniavsky-Paskin\n
Benjamin DeCoste\n Benjamin DeCoste\n
Ben Keen\n Ben Keen\n
Ben Mosher\n
Bernhard Sirlinger\n Bernhard Sirlinger\n
Bert Chang\n Bert Chang\n
Billy Moon\n Billy Moon\n
...@@ -93,23 +111,35 @@ Blaine G\n ...@@ -93,23 +111,35 @@ Blaine G\n
blukat29\n blukat29\n
boomyjee\n boomyjee\n
borawjm\n borawjm\n
Brad Metcalf\n
Brandon Frohs\n Brandon Frohs\n
Brandon Wamboldt\n Brandon Wamboldt\n
Brett Zamir\n Brett Zamir\n
Brian Grinstead\n Brian Grinstead\n
Brian Sletten\n Brian Sletten\n
Bruce Mitchener\n Bruce Mitchener\n
Caitlin Potter\n
Calin Barbat\n
Chad Jolly\n
Chandra Sekhar Pydi\n Chandra Sekhar Pydi\n
Charles Skelton\n Charles Skelton\n
Cheah Chu Yeow\n Cheah Chu Yeow\n
Chris Coyier\n Chris Coyier\n
Chris Ford\n
Chris Granger\n Chris Granger\n
Chris Houseknecht\n Chris Houseknecht\n
Chris Lohfink\n
Chris Morgan\n Chris Morgan\n
Christian Oyarzun\n Christian Oyarzun\n
Christian Petrov\n
Christopher Brown\n Christopher Brown\n
Christopher Mitchell\n
Christopher Pfohl\n
Chunliang Lyu\n
ciaranj\n ciaranj\n
CodeAnimal\n CodeAnimal\n
coderaiser\n
Cole R Lawrence\n
ComFreek\n ComFreek\n
Curtis Gagliardi\n Curtis Gagliardi\n
dagsta\n dagsta\n
...@@ -121,21 +151,27 @@ Daniel, Dao Quang Minh\n ...@@ -121,21 +151,27 @@ Daniel, Dao Quang Minh\n
Daniele Di Sarli\n Daniele Di Sarli\n
Daniel Faust\n Daniel Faust\n
Daniel Huigens\n Daniel Huigens\n
Daniel Kesler\n
Daniel KJ\n Daniel KJ\n
Daniel Neel\n Daniel Neel\n
Daniel Parnell\n Daniel Parnell\n
Danny Yoo\n Danny Yoo\n
darealshinji\n darealshinji\n
Darius Roberts\n Darius Roberts\n
Dave Brondsema\n
Dave Myers\n Dave Myers\n
David Barnett\n
David Mignot\n David Mignot\n
David Pathakjee\n David Pathakjee\n
David Vázquez\n David Vázquez\n
David Whittington\n
deebugger\n deebugger\n
Deep Thought\n Deep Thought\n
Devin Abbott\n
Devon Carew\n Devon Carew\n
dignifiedquire\n dignifiedquire\n
Dimage Sapelkin\n Dimage Sapelkin\n
Dmitry Kiselyov\n
domagoj412\n domagoj412\n
Dominator008\n Dominator008\n
Domizio Demichelis\n Domizio Demichelis\n
...@@ -143,13 +179,16 @@ Doug Wikle\n ...@@ -143,13 +179,16 @@ Doug Wikle\n
Drew Bratcher\n Drew Bratcher\n
Drew Hintz\n Drew Hintz\n
Drew Khoury\n Drew Khoury\n
Drini Cami\n
Dror BG\n Dror BG\n
duralog\n duralog\n
eborden\n eborden\n
edsharp\n edsharp\n
ekhaled\n ekhaled\n
Elisée\n
Enam Mijbah Noor\n Enam Mijbah Noor\n
Eric Allam\n Eric Allam\n
Erik Welander\n
eustas\n eustas\n
Fabien O\'Carroll\n Fabien O\'Carroll\n
Fabio Zendhi Nagao\n Fabio Zendhi Nagao\n
...@@ -164,43 +203,54 @@ flack\n ...@@ -164,43 +203,54 @@ flack\n
ForbesLindesay\n ForbesLindesay\n
Forbes Lindesay\n Forbes Lindesay\n
Ford_Lawnmower\n Ford_Lawnmower\n
Forrest Oliphant\n
Frank Wiegand\n Frank Wiegand\n
Gabriel Gheorghian\n Gabriel Gheorghian\n
Gabriel Horner\n Gabriel Horner\n
Gabriel Nahmias\n Gabriel Nahmias\n
galambalazs\n galambalazs\n
Gautam Mehta\n Gautam Mehta\n
Gavin Douglas\n
gekkoe\n gekkoe\n
geowarin\n
Gerard Braad\n Gerard Braad\n
Gergely Hegykozi\n Gergely Hegykozi\n
Giovanni Calò\n
Glebov Boris\n
Glenn Jorde\n Glenn Jorde\n
Glenn Ruehle\n Glenn Ruehle\n
Golevka\n Golevka\n
Google Inc.\n
Gordon Smith\n Gordon Smith\n
Grant Skinner\n Grant Skinner\n
greengiant\n greengiant\n
Gregory Koberger\n Gregory Koberger\n
Guillaume Massé\n Guillaume Massé\n
Guillaume Massé\n Guillaume Massé\n
guraga\n
Gustavo Rodrigues\n Gustavo Rodrigues\n
Hakan Tunc\n Hakan Tunc\n
Hans Engel\n Hans Engel\n
Hardest\n Hardest\n
Hasan Karahan\n Hasan Karahan\n
Hector Oswaldo Caballero\n
Herculano Campos\n Herculano Campos\n
Hiroyuki Makino\n Hiroyuki Makino\n
hitsthings\n hitsthings\n
Hocdoc\n Hocdoc\n
Hugues Malphettes\n
Ian Beck\n Ian Beck\n
Ian Dickinson\n Ian Dickinson\n
Ian Wehrman\n Ian Wehrman\n
Ian Wetherbee\n Ian Wetherbee\n
Ice White\n Ice White\n
ICHIKAWA, Yuji\n ICHIKAWA, Yuji\n
idleberg\n
ilvalle\n ilvalle\n
Ingo Richter\n Ingo Richter\n
Irakli Gozalishvili\n Irakli Gozalishvili\n
Ivan Kurnosov\n Ivan Kurnosov\n
Ivoah\n
Jacob Lee\n Jacob Lee\n
Jakob Miland\n Jakob Miland\n
Jakub Vrana\n Jakub Vrana\n
...@@ -212,6 +262,7 @@ Jan Jongboom\n ...@@ -212,6 +262,7 @@ Jan Jongboom\n
jankeromnes\n jankeromnes\n
Jan Keromnes\n Jan Keromnes\n
Jan Odvarko\n Jan Odvarko\n
Jan Schär\n
Jan T. Sott\n Jan T. Sott\n
Jared Forsyth\n Jared Forsyth\n
Jason\n Jason\n
...@@ -222,34 +273,49 @@ Jason San Jose\n ...@@ -222,34 +273,49 @@ Jason San Jose\n
Jason Siefken\n Jason Siefken\n
Jaydeep Solanki\n Jaydeep Solanki\n
Jean Boussier\n Jean Boussier\n
Jeff Blaisdell\n
jeffkenton\n jeffkenton\n
Jeff Pickhardt\n Jeff Pickhardt\n
jem (graphite)\n jem (graphite)\n
Jeremy Parmenter\n Jeremy Parmenter\n
Jim\n
JobJob\n
jochenberger\n
Jochen Berger\n Jochen Berger\n
Johan Ask\n Johan Ask\n
John Connor\n John Connor\n
John Engler\n
John Lees-Miller\n John Lees-Miller\n
John Snelson\n John Snelson\n
John Van Der Loo\n John Van Der Loo\n
Jon Ander Peñalba\n
Jonas Döbertin\n
Jonathan Malmaud\n Jonathan Malmaud\n
jongalloway\n jongalloway\n
Jon Malmaud\n Jon Malmaud\n
Jon Sangster\n Jon Sangster\n
Joost-Wim Boekesteijn\n Joost-Wim Boekesteijn\n
Joseph Pecoraro\n Joseph Pecoraro\n
Josh Cohen\n
Joshua Newman\n Joshua Newman\n
Josh Watzman\n Josh Watzman\n
jots\n jots\n
jsoojeon\n jsoojeon\n
ju1ius\n
Juan Benavides Romero\n Juan Benavides Romero\n
Jucovschi Constantin\n Jucovschi Constantin\n
Juho Vuori\n Juho Vuori\n
Julien Rebetez\n
Justin Andresen\n
Justin Hileman\n Justin Hileman\n
jwallers@gmail.com\n jwallers@gmail.com\n
kaniga\n kaniga\n
karevn\n
Kayur Patel\n
Ken Newman\n Ken Newman\n
ken restivo\n
Ken Rockot\n Ken Rockot\n
Kevin Earls\n
Kevin Sawicki\n Kevin Sawicki\n
Kevin Ushey\n Kevin Ushey\n
Klaus Silveira\n Klaus Silveira\n
...@@ -259,6 +325,7 @@ Konstantin Lopuhin\n ...@@ -259,6 +325,7 @@ Konstantin Lopuhin\n
koops\n koops\n
ks-ifware\n ks-ifware\n
kubelsmieci\n kubelsmieci\n
KwanEsq\n
Lanfei\n Lanfei\n
Lanny\n Lanny\n
Laszlo Vidacs\n Laszlo Vidacs\n
...@@ -267,12 +334,16 @@ Leonid Khachaturov\n ...@@ -267,12 +334,16 @@ Leonid Khachaturov\n
Leon Sorokin\n Leon Sorokin\n
Leonya Khachaturov\n Leonya Khachaturov\n
Liam Newman\n Liam Newman\n
Libo Cannici\n
LloydMilligan\n
LM\n LM\n
lochel\n lochel\n
Lorenzo Stoakes\n Lorenzo Stoakes\n
Luciano Longo\n Luciano Longo\n
Luke Stagner\n Luke Stagner\n
lynschinzer\n lynschinzer\n
M1cha\n
Madhura Jayaratne\n
Maksim Lin\n Maksim Lin\n
Maksym Taran\n Maksym Taran\n
Malay Majithia\n Malay Majithia\n
...@@ -282,19 +353,28 @@ Marcel Gerber\n ...@@ -282,19 +353,28 @@ Marcel Gerber\n
Marco Aurélio\n Marco Aurélio\n
Marco Munizaga\n Marco Munizaga\n
Marcus Bointon\n Marcus Bointon\n
Marek Rudnicki\n
Marijn Haverbeke\n Marijn Haverbeke\n
Mário Gonçalves\n Mário Gonçalves\n
Mario Pietsch\n Mario Pietsch\n
Mark Anderson\n
Mark Lentczner\n Mark Lentczner\n
Marko Bonaci\n Marko Bonaci\n
Markus Bordihn\n
Martin Balek\n Martin Balek\n
Martín Gaitán\n Martín Gaitán\n
Martin Hasoň\n Martin Hasoň\n
Martin Hunt\n
Martin Laine\n
Martin Zagora\n
Mason Malone\n Mason Malone\n
Mateusz Paprocki\n Mateusz Paprocki\n
Mathias Bynens\n Mathias Bynens\n
mats cronqvist\n mats cronqvist\n
Matt Gaide\n
Matthew Bauer\n
Matthew Beale\n Matthew Beale\n
Matthew Rathbone\n
Matthias Bussonnier\n Matthias Bussonnier\n
Matthias BUSSONNIER\n Matthias BUSSONNIER\n
Matt McDonald\n Matt McDonald\n
...@@ -304,14 +384,23 @@ mauricio\n ...@@ -304,14 +384,23 @@ mauricio\n
Maximilian Hils\n Maximilian Hils\n
Maxim Kraev\n Maxim Kraev\n
Max Kirsch\n Max Kirsch\n
Max Schaefer\n
Max Xiantu\n Max Xiantu\n
mbarkhau\n mbarkhau\n
McBrainy\n
melpon\n
Metatheos\n Metatheos\n
Micah Dubinko\n Micah Dubinko\n
Michael\n
Michael Goderbauer\n
Michael Grey\n
Michael Kaminsky\n
Michael Lehenbauer\n Michael Lehenbauer\n
Michael Zhou\n Michael Zhou\n
Michal Dorner\n
Mighty Guava\n Mighty Guava\n
Miguel Castillo\n Miguel Castillo\n
mihailik\n
Mike\n Mike\n
Mike Brevoort\n Mike Brevoort\n
Mike Diaz\n Mike Diaz\n
...@@ -320,20 +409,25 @@ Mike Kadin\n ...@@ -320,20 +409,25 @@ Mike Kadin\n
MinRK\n MinRK\n
Miraculix87\n Miraculix87\n
misfo\n misfo\n
mkaminsky11\n
mloginov\n mloginov\n
Moritz Schwörer\n Moritz Schwörer\n
mps\n mps\n
ms\n
mtaran-google\n mtaran-google\n
Narciso Jaramillo\n Narciso Jaramillo\n
Nathan Williams\n Nathan Williams\n
ndr\n ndr\n
nerbert\n nerbert\n
nextrevision\n nextrevision\n
ngn\n
nguillaumin\n nguillaumin\n
Ng Zhi An\n Ng Zhi An\n
Nicholas Bollweg\n Nicholas Bollweg\n
Nicholas Bollweg (Nick)\n Nicholas Bollweg (Nick)\n
Nick Kreeger\n
Nick Small\n Nick Small\n
Nicolò Ribaudo\n
Niels van Groningen\n Niels van Groningen\n
nightwing\n nightwing\n
Nikita Beloglazov\n Nikita Beloglazov\n
...@@ -342,37 +436,54 @@ Nikolay Kostov\n ...@@ -342,37 +436,54 @@ Nikolay Kostov\n
nilp0inter\n nilp0inter\n
Nisarg Jhaveri\n Nisarg Jhaveri\n
nlwillia\n nlwillia\n
noragrossman\n
Norman Rzepka\n Norman Rzepka\n
Oreoluwa Onatemowo\n
pablo\n pablo\n
pabloferz\n
Page\n Page\n
Panupong Pasupat\n Panupong Pasupat\n
paris\n paris\n
Paris\n
Patil Arpith\n Patil Arpith\n
Patrick Stoica\n Patrick Stoica\n
Patrick Strawderman\n Patrick Strawderman\n
Paul Garvin\n Paul Garvin\n
Paul Ivanov\n Paul Ivanov\n
Pavel\n
Pavel Feldman\n Pavel Feldman\n
Pavel Strashkin\n Pavel Strashkin\n
Paweł Bartkiewicz\n Paweł Bartkiewicz\n
peteguhl\n peteguhl\n
peter\n
Peter Flynn\n Peter Flynn\n
peterkroon\n peterkroon\n
Peter Kroon\n Peter Kroon\n
Philipp A\n
Philip Stadermann\n
Pierre Gerold\n
Piët Delport\n
prasanthj\n prasanthj\n
Prasanth J\n Prasanth J\n
Prayag Verma\n
Radek Piórkowski\n Radek Piórkowski\n
Rahul\n Rahul\n
Rahul Anand\n
ramwin1\n
Randall Mason\n Randall Mason\n
Randy Burden\n Randy Burden\n
Randy Edmunds\n Randy Edmunds\n
Rasmus Erik Voel Jensen\n Rasmus Erik Voel Jensen\n
ray ratchup\n
Ray Ratchup\n
Richard Denton\n
Richard van der Meer\n Richard van der Meer\n
Richard Z.H. Wang\n Richard Z.H. Wang\n
Robert Crossfield\n Robert Crossfield\n
Roberto Abdelkader Martínez Pérez\n Roberto Abdelkader Martínez Pérez\n
robertop23\n robertop23\n
Robert Plummer\n Robert Plummer\n
Rrandom\n
Ruslan Osmanov\n Ruslan Osmanov\n
Ryan Prior\n Ryan Prior\n
sabaca\n sabaca\n
...@@ -381,20 +492,26 @@ sandeepshetty\n ...@@ -381,20 +492,26 @@ sandeepshetty\n
Sander AKA Redsandro\n Sander AKA Redsandro\n
santec\n santec\n
Sascha Peilicke\n Sascha Peilicke\n
satamas\n
satchmorun\n satchmorun\n
sathyamoorthi\n sathyamoorthi\n
S. Chris Colbert\n
SCLINIC\\jdecker\n SCLINIC\\jdecker\n
Scott Aikin\n Scott Aikin\n
Scott Goodhew\n Scott Goodhew\n
Sebastian Zaha\n Sebastian Zaha\n
Sergey Goder\n
Se-Won Kim\n
shaund\n shaund\n
shaun gilchrist\n shaun gilchrist\n
Shawn A\n Shawn A\n
Shea Bunge\n
sheopory\n sheopory\n
Shiv Deepak\n Shiv Deepak\n
Shmuel Englard\n Shmuel Englard\n
Shubham Jain\n Shubham Jain\n
silverwind\n silverwind\n
sinkuu\n
snasa\n snasa\n
soliton4\n soliton4\n
sonson\n sonson\n
...@@ -404,13 +521,23 @@ Stanislav Oaserele\n ...@@ -404,13 +521,23 @@ Stanislav Oaserele\n
Stas Kobzar\n Stas Kobzar\n
Stefan Borsje\n Stefan Borsje\n
Steffen Beyer\n Steffen Beyer\n
Steffen Bruchmann\n
Stephen Lavelle\n
Steve Champagne\n
Steve O\'Hara\n Steve O\'Hara\n
stoskov\n stoskov\n
Stu Kennedy\n
Sungho Kim\n
sverweij\n
Taha Jahangir\n Taha Jahangir\n
Tako Schotanus\n
Takuji Shimokawa\n Takuji Shimokawa\n
Tarmil\n Tarmil\n
TDaglis\n
tel\n
tfjgeorge\n tfjgeorge\n
Thaddee Tyl\n Thaddee Tyl\n
thanasis\n
TheHowl\n TheHowl\n
think\n think\n
Thomas Dvornik\n Thomas Dvornik\n
...@@ -427,24 +554,32 @@ Tom MacWright\n ...@@ -427,24 +554,32 @@ Tom MacWright\n
Tony Jian\n Tony Jian\n
Travis Heppe\n Travis Heppe\n
Triangle717\n Triangle717\n
Tristan Tarrant\n
TSUYUSATO Kitsune\n
twifkak\n twifkak\n
Vestimir Markov\n Vestimir Markov\n
vf\n vf\n
Victor Bocharsky\n
Vincent Woo\n Vincent Woo\n
Volker Mische\n Volker Mische\n
wenli\n wenli\n
Wes Cossick\n
Wesley Wiser\n Wesley Wiser\n
Will Binns-Smith\n Will Binns-Smith\n
Will Dean\n
William Jamieson\n William Jamieson\n
William Stein\n William Stein\n
Willy\n Willy\n
Wojtek Ptak\n Wojtek Ptak\n
Wu Cheng-Han\n
Xavier Mendez\n Xavier Mendez\n
Yassin N. Hassan\n Yassin N. Hassan\n
YNH Webdev\n YNH Webdev\n
Yunchi Luo\n Yunchi Luo\n
Yuvi Panda\n Yuvi Panda\n
Zac Anger\n
Zachary Dremann\n Zachary Dremann\n
Zhang Hao\n
zziuni\n zziuni\n
魏鹏刚\n 魏鹏刚\n
</string> </value> </string> </value>
......
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
<key> <string>raw</string> </key> <key> <string>raw</string> </key>
<value> <string># How to contribute\n <value> <string># How to contribute\n
\n \n
- [Getting help](#getting-help-)\n - [Getting help](#getting-help)\n
- [Submitting bug reports](#submitting-bug-reports-)\n - [Submitting bug reports](#submitting-bug-reports)\n
- [Contributing code](#contributing-code-)\n - [Contributing code](#contributing-code)\n
\n \n
## Getting help\n ## Getting help\n
\n \n
...@@ -87,12 +87,24 @@ should be asked on the\n ...@@ -87,12 +87,24 @@ should be asked on the\n
- Make sure all tests pass. Visit `test/index.html` in your browser to\n - Make sure all tests pass. Visit `test/index.html` in your browser to\n
run them.\n run them.\n
- Submit a pull request\n - Submit a pull request\n
([how to create a pull request](https://help.github.com/articles/fork-a-repo))\n ([how to create a pull request](https://help.github.com/articles/fork-a-repo)).\n
Don\'t put more than one feature/fix in a single pull request.\n
\n
By contributing code to CodeMirror you\n
\n
- agree to license the contributed code under CodeMirror\'s [MIT\n
license](http://codemirror.net/LICENSE).\n
\n
- confirm that you have the right to contribute and license the code\n
in question. (Either you hold all rights on the code, or the rights\n
holder has explicitly granted the right to use it like this,\n
through a compatible open source license or through a direct\n
agreement with you.)\n
\n \n
### Coding standards\n ### Coding standards\n
\n \n
- 2 spaces per indentation level, no tabs.\n - 2 spaces per indentation level, no tabs.\n
- Include semicolons after statements.\n \n
- Note that the linter (`bin/lint`) which is run after each commit\n - Note that the linter (`bin/lint`) which is run after each commit\n
complains about unused variables and functions. Prefix their names\n complains about unused variables and functions. Prefix their names\n
with an underscore to muffle it.\n with an underscore to muffle it.\n
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<key> <string>raw</string> </key> <key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
Copyright (C) 2014 by Marijn Haverbeke <marijnh@gmail.com> and others\n Copyright (C) 2016 by Marijn Haverbeke <marijnh@gmail.com> and others\n
\n \n
Permission is hereby granted, free of charge, to any person obtaining a copy\n Permission is hereby granted, free of charge, to any person obtaining a copy\n
of this software and associated documentation files (the "Software"), to deal\n of this software and associated documentation files (the "Software"), to deal\n
......
...@@ -27,14 +27,31 @@ ...@@ -27,14 +27,31 @@
<value> <string># CodeMirror\n <value> <string># CodeMirror\n
[![Build Status](https://travis-ci.org/codemirror/CodeMirror.svg)](https://travis-ci.org/codemirror/CodeMirror)\n [![Build Status](https://travis-ci.org/codemirror/CodeMirror.svg)](https://travis-ci.org/codemirror/CodeMirror)\n
[![NPM version](https://img.shields.io/npm/v/codemirror.svg)](https://www.npmjs.org/package/codemirror)\n [![NPM version](https://img.shields.io/npm/v/codemirror.svg)](https://www.npmjs.org/package/codemirror)\n
[![Join the chat at https://gitter.im/codemirror/CodeMirror](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/codemirror/CodeMirror) \n
[Funding status: ![maintainer happiness](https://marijnhaverbeke.nl/fund/status_s.png?again)](https://marijnhaverbeke.nl/fund/)\n
\n \n
CodeMirror is a JavaScript component that provides a code editor in\n CodeMirror is a versatile text editor implemented in JavaScript for\n
the browser. When a mode is available for the language you are coding\n the browser. It is specialized for editing code, and comes with over\n
in, it will color your code, and optionally help with indentation.\n 100 language modes and various addons that implement more advanced\n
editing functionality.\n
\n \n
The project page is http://codemirror.net \n A rich programming API and a CSS theming system are available for\n
The manual is at http://codemirror.net/doc/manual.html \n customizing CodeMirror to fit your application, and extending it with\n
The contributing guidelines are in [CONTRIBUTING.md](https://github.com/codemirror/CodeMirror/blob/master/CONTRIBUTING.md)\n new functionality.\n
\n
You can find more information (and the\n
[manual](http://codemirror.net/doc/manual.html)) on the [project\n
page](http://codemirror.net). For questions and discussion, use the\n
[discussion forum](https://discuss.codemirror.net/).\n
\n
See\n
[CONTRIBUTING.md](https://github.com/codemirror/CodeMirror/blob/master/CONTRIBUTING.md)\n
for contributing guidelines.\n
\n
The CodeMirror community aims to be welcoming to everybody. We use the\n
[Contributor Covenant\n
(1.1)](http://contributor-covenant.org/version/1/1/0/) as our code of\n
conduct.\n
</string> </value> </string> </value>
</item> </item>
</dictionary> </dictionary>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897295.63</string> </value> <value> <string>ts60604371.94</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -122,33 +122,36 @@ ...@@ -122,33 +122,36 @@
}\n }\n
}\n }\n
\n \n
function autoCloseSlash(cm) {\n function autoCloseCurrent(cm, typingSlash) {\n
if (cm.getOption("disableInput")) return CodeMirror.Pass;\n
var ranges = cm.listSelections(), replacements = [];\n var ranges = cm.listSelections(), replacements = [];\n
var head = typingSlash ? "/" : "</";\n
for (var i = 0; i < ranges.length; i++) {\n for (var i = 0; i < ranges.length; i++) {\n
if (!ranges[i].empty()) return CodeMirror.Pass;\n if (!ranges[i].empty()) return CodeMirror.Pass;\n
var pos = ranges[i].head, tok = cm.getTokenAt(pos);\n var pos = ranges[i].head, tok = cm.getTokenAt(pos);\n
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;\n var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;\n
if (tok.type == "string" || tok.string.charAt(0) != "<" ||\n if (typingSlash && (tok.type == "string" || tok.string.charAt(0) != "<" ||\n
tok.start != pos.ch - 1)\n tok.start != pos.ch - 1))\n
return CodeMirror.Pass;\n return CodeMirror.Pass;\n
// Kludge to get around the fact that we are not in XML mode\n // Kludge to get around the fact that we are not in XML mode\n
// when completing in JS/CSS snippet in htmlmixed mode. Does not\n // when completing in JS/CSS snippet in htmlmixed mode. Does not\n
// work for other XML embedded languages (there is no general\n // work for other XML embedded languages (there is no general\n
// way to go from a mixed mode to its current XML state).\n // way to go from a mixed mode to its current XML state).\n
var replacement;\n
if (inner.mode.name != "xml") {\n if (inner.mode.name != "xml") {\n
if (cm.getMode().name == "htmlmixed" && inner.mode.name == "javascript")\n if (cm.getMode().name == "htmlmixed" && inner.mode.name == "javascript")\n
replacements[i] = "/script>";\n replacement = head + "script";\n
else if (cm.getMode().name == "htmlmixed" && inner.mode.name == "css")\n else if (cm.getMode().name == "htmlmixed" && inner.mode.name == "css")\n
replacements[i] = "/style>";\n replacement = head + "style";\n
else\n else\n
return CodeMirror.Pass;\n return CodeMirror.Pass;\n
} else {\n } else {\n
if (!state.context || !state.context.tagName ||\n if (!state.context || !state.context.tagName ||\n
closingTagExists(cm, state.context.tagName, pos, state))\n closingTagExists(cm, state.context.tagName, pos, state))\n
return CodeMirror.Pass;\n return CodeMirror.Pass;\n
replacements[i] = "/" + state.context.tagName + ">";\n replacement = head + state.context.tagName;\n
}\n }\n
if (cm.getLine(pos.line).charAt(tok.end) != ">") replacement += ">";\n
replacements[i] = replacement;\n
}\n }\n
cm.replaceSelections(replacements);\n cm.replaceSelections(replacements);\n
ranges = cm.listSelections();\n ranges = cm.listSelections();\n
...@@ -156,6 +159,13 @@ ...@@ -156,6 +159,13 @@
if (i == ranges.length - 1 || ranges[i].head.line < ranges[i + 1].head.line)\n if (i == ranges.length - 1 || ranges[i].head.line < ranges[i + 1].head.line)\n
cm.indentLine(ranges[i].head.line);\n cm.indentLine(ranges[i].head.line);\n
}\n }\n
\n
function autoCloseSlash(cm) {\n
if (cm.getOption("disableInput")) return CodeMirror.Pass;\n
return autoCloseCurrent(cm, true);\n
}\n
\n
CodeMirror.commands.closeTag = function(cm) { return autoCloseCurrent(cm); };\n
\n \n
function indexOf(collection, elt) {\n function indexOf(collection, elt) {\n
if (collection.indexOf) return collection.indexOf(elt);\n if (collection.indexOf) return collection.indexOf(elt);\n
...@@ -195,7 +205,7 @@ ...@@ -195,7 +205,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>7331</int> </value> <value> <int>7705</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897295.78</string> </value> <value> <string>ts60604371.99</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -39,36 +39,36 @@ ...@@ -39,36 +39,36 @@
})(function(CodeMirror) {\n })(function(CodeMirror) {\n
"use strict";\n "use strict";\n
\n \n
var listRE = /^(\\s*)(>[> ]*|[*+-]\\s|(\\d+)\\.)(\\s*)/,\n var listRE = /^(\\s*)(>[> ]*|[*+-]\\s|(\\d+)([.)]))(\\s*)/,\n
emptyListRE = /^(\\s*)(>[> ]*|[*+-]|(\\d+)\\.)(\\s*)$/,\n emptyListRE = /^(\\s*)(>[> ]*|[*+-]|(\\d+)[.)])(\\s*)$/,\n
unorderedListRE = /[*+-]\\s/;\n unorderedListRE = /[*+-]\\s/;\n
\n \n
CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {\n CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {\n
if (cm.getOption("disableInput")) return CodeMirror.Pass;\n if (cm.getOption("disableInput")) return CodeMirror.Pass;\n
var ranges = cm.listSelections(), replacements = [];\n var ranges = cm.listSelections(), replacements = [];\n
for (var i = 0; i < ranges.length; i++) {\n for (var i = 0; i < ranges.length; i++) {\n
var pos = ranges[i].head, match;\n var pos = ranges[i].head;\n
var eolState = cm.getStateAfter(pos.line);\n var eolState = cm.getStateAfter(pos.line);\n
var inList = eolState.list !== false;\n var inList = eolState.list !== false;\n
var inQuote = eolState.quote !== false;\n var inQuote = eolState.quote !== 0;\n
\n \n
if (!ranges[i].empty() || (!inList && !inQuote) || !(match = cm.getLine(pos.line).match(listRE))) {\n var line = cm.getLine(pos.line), match = listRE.exec(line);\n
if (!ranges[i].empty() || (!inList && !inQuote) || !match) {\n
cm.execCommand("newlineAndIndent");\n cm.execCommand("newlineAndIndent");\n
return;\n return;\n
}\n }\n
if (cm.getLine(pos.line).match(emptyListRE)) {\n if (emptyListRE.test(line)) {\n
cm.replaceRange("", {\n cm.replaceRange("", {\n
line: pos.line, ch: 0\n line: pos.line, ch: 0\n
}, {\n }, {\n
line: pos.line, ch: pos.ch + 1\n line: pos.line, ch: pos.ch + 1\n
});\n });\n
replacements[i] = "\\n";\n replacements[i] = "\\n";\n
\n
} else {\n } else {\n
var indent = match[1], after = match[4];\n var indent = match[1], after = match[5];\n
var bullet = unorderedListRE.test(match[2]) || match[2].indexOf(">") >= 0\n var bullet = unorderedListRE.test(match[2]) || match[2].indexOf(">") >= 0\n
? match[2]\n ? match[2]\n
: (parseInt(match[3], 10) + 1) + ".";\n : (parseInt(match[3], 10) + 1) + match[4];\n
\n \n
replacements[i] = "\\n" + indent + bullet + after;\n replacements[i] = "\\n" + indent + bullet + after;\n
}\n }\n
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>1752</int> </value> <value> <int>1761</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897295.92</string> </value> <value> <string>ts60604372.04</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
if (marks.length) {\n if (marks.length) {\n
// Kludge to work around the IE bug from issue #1193, where text\n // Kludge to work around the IE bug from issue #1193, where text\n
// input stops going to the textare whever this fires.\n // input stops going to the textare whever this fires.\n
if (ie_lt8 && cm.state.focused) cm.display.input.focus();\n if (ie_lt8 && cm.state.focused) cm.focus();\n
\n \n
var clear = function() {\n var clear = function() {\n
cm.operation(function() {\n cm.operation(function() {\n
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>5268</int> </value> <value> <int>5254</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897296.03</string> </value> <value> <string>ts60604372.1</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897285.4</string> </value> <value> <string>ts60604372.11</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897117.58</string> </value> <value> <string>ts60604372.17</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -49,22 +49,28 @@ ...@@ -49,22 +49,28 @@
}\n }\n
\n \n
CodeMirror.commands.toggleComment = function(cm) {\n CodeMirror.commands.toggleComment = function(cm) {\n
var minLine = Infinity, ranges = cm.listSelections(), mode = null;\n cm.toggleComment();\n
};\n
\n
CodeMirror.defineExtension("toggleComment", function(options) {\n
if (!options) options = noOptions;\n
var cm = this;\n
var minLine = Infinity, ranges = this.listSelections(), mode = null;\n
for (var i = ranges.length - 1; i >= 0; i--) {\n for (var i = ranges.length - 1; i >= 0; i--) {\n
var from = ranges[i].from(), to = ranges[i].to();\n var from = ranges[i].from(), to = ranges[i].to();\n
if (from.line >= minLine) continue;\n if (from.line >= minLine) continue;\n
if (to.line >= minLine) to = Pos(minLine, 0);\n if (to.line >= minLine) to = Pos(minLine, 0);\n
minLine = from.line;\n minLine = from.line;\n
if (mode == null) {\n if (mode == null) {\n
if (cm.uncomment(from, to)) mode = "un";\n if (cm.uncomment(from, to, options)) mode = "un";\n
else { cm.lineComment(from, to); mode = "line"; }\n else { cm.lineComment(from, to, options); mode = "line"; }\n
} else if (mode == "un") {\n } else if (mode == "un") {\n
cm.uncomment(from, to);\n cm.uncomment(from, to, options);\n
} else {\n } else {\n
cm.lineComment(from, to);\n cm.lineComment(from, to, options);\n
}\n }\n
}\n }\n
};\n });\n
\n \n
CodeMirror.defineExtension("lineComment", function(from, to, options) {\n CodeMirror.defineExtension("lineComment", function(from, to, options) {\n
if (!options) options = noOptions;\n if (!options) options = noOptions;\n
...@@ -85,7 +91,14 @@ ...@@ -85,7 +91,14 @@
\n \n
self.operation(function() {\n self.operation(function() {\n
if (options.indent) {\n if (options.indent) {\n
var baseString = firstLine.slice(0, firstNonWS(firstLine));\n var baseString = null;\n
for (var i = from.line; i < end; ++i) {\n
var line = self.getLine(i);\n
var whitespace = line.slice(0, firstNonWS(line));\n
if (baseString == null || baseString.length > whitespace.length) {\n
baseString = whitespace;\n
}\n
}\n
for (var i = from.line; i < end; ++i) {\n for (var i = from.line; i < end; ++i) {\n
var line = self.getLine(i), cut = baseString.length;\n var line = self.getLine(i), cut = baseString.length;\n
if (!blankLines && !nonWS.test(line)) continue;\n if (!blankLines && !nonWS.test(line)) continue;\n
...@@ -219,7 +232,7 @@ ...@@ -219,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>8008</int> </value> <value> <int>8446</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897117.72</string> </value> <value> <string>ts60604372.22</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -31,11 +31,11 @@ ...@@ -31,11 +31,11 @@
<value> <string>.CodeMirror-dialog {\n <value> <string>.CodeMirror-dialog {\n
position: absolute;\n position: absolute;\n
left: 0; right: 0;\n left: 0; right: 0;\n
background: white;\n background: inherit;\n
z-index: 15;\n z-index: 15;\n
padding: .1em .8em;\n padding: .1em .8em;\n
overflow: hidden;\n overflow: hidden;\n
color: #333;\n color: inherit;\n
}\n }\n
\n \n
.CodeMirror-dialog-top {\n .CodeMirror-dialog-top {\n
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897119.98</string> </value> <value> <string>ts60604372.34</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -84,10 +84,14 @@ ...@@ -84,10 +84,14 @@
\n \n
var inp = dialog.getElementsByTagName("input")[0], button;\n var inp = dialog.getElementsByTagName("input")[0], button;\n
if (inp) {\n if (inp) {\n
inp.focus();\n
\n
if (options.value) {\n if (options.value) {\n
inp.value = options.value;\n inp.value = options.value;\n
if (options.selectValueOnOpen !== false) {\n
inp.select();\n inp.select();\n
}\n }\n
}\n
\n \n
if (options.onInput)\n if (options.onInput)\n
CodeMirror.on(inp, "input", function(e) { options.onInput(e, inp.value, close);});\n CodeMirror.on(inp, "input", function(e) { options.onInput(e, inp.value, close);});\n
...@@ -105,8 +109,6 @@ ...@@ -105,8 +109,6 @@
});\n });\n
\n \n
if (options.closeOnBlur !== false) CodeMirror.on(inp, "blur", close);\n if (options.closeOnBlur !== false) CodeMirror.on(inp, "blur", close);\n
\n
inp.focus();\n
} else if (button = dialog.getElementsByTagName("button")[0]) {\n } else if (button = dialog.getElementsByTagName("button")[0]) {\n
CodeMirror.on(button, "click", function() {\n CodeMirror.on(button, "click", function() {\n
close();\n close();\n
...@@ -191,7 +193,7 @@ ...@@ -191,7 +193,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>4875</int> </value> <value> <int>4938</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts60604372.39</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>autorefresh.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>data</string> </key>
<value> <string encoding="cdata"><![CDATA[
// CodeMirror, copyright (c) by Marijn Haverbeke and others\n
// Distributed under an MIT license: http://codemirror.net/LICENSE\n
\n
(function(mod) {\n
if (typeof exports == "object" && typeof module == "object") // CommonJS\n
mod(require("../../lib/codemirror"))\n
else if (typeof define == "function" && define.amd) // AMD\n
define(["../../lib/codemirror"], mod)\n
else // Plain browser env\n
mod(CodeMirror)\n
})(function(CodeMirror) {\n
"use strict"\n
\n
CodeMirror.defineOption("autoRefresh", false, function(cm, val) {\n
if (cm.state.autoRefresh) {\n
stopListening(cm, cm.state.autoRefresh)\n
cm.state.autoRefresh = null\n
}\n
if (val && cm.display.wrapper.offsetHeight == 0)\n
startListening(cm, cm.state.autoRefresh = {delay: val.delay || 250})\n
})\n
\n
function startListening(cm, state) {\n
function check() {\n
if (cm.display.wrapper.offsetHeight) {\n
stopListening(cm, state)\n
if (cm.display.lastWrapHeight != cm.display.wrapper.clientHeight)\n
cm.refresh()\n
} else {\n
state.timeout = setTimeout(check, state.delay)\n
}\n
}\n
state.timeout = setTimeout(check, state.delay)\n
state.hurry = function() {\n
clearTimeout(state.timeout)\n
state.timeout = setTimeout(check, 50)\n
}\n
CodeMirror.on(window, "mouseup", state.hurry)\n
CodeMirror.on(window, "keyup", state.hurry)\n
}\n
\n
function stopListening(_cm, state) {\n
clearTimeout(state.timeout)\n
CodeMirror.off(window, "mouseup", state.hurry)\n
CodeMirror.off(window, "keyup", state.hurry)\n
}\n
});\n
]]></string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>1543</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897117.34</string> </value> <value> <string>ts60604372.5</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897117.22</string> </value> <value> <string>ts60604372.55</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -38,13 +38,31 @@ ...@@ -38,13 +38,31 @@
mod(CodeMirror);\n mod(CodeMirror);\n
})(function(CodeMirror) {\n })(function(CodeMirror) {\n
CodeMirror.defineExtension("addPanel", function(node, options) {\n CodeMirror.defineExtension("addPanel", function(node, options) {\n
options = options || {};\n
\n
if (!this.state.panels) initPanels(this);\n if (!this.state.panels) initPanels(this);\n
\n \n
var info = this.state.panels;\n var info = this.state.panels;\n
if (options && options.position == "bottom")\n var wrapper = info.wrapper;\n
info.wrapper.appendChild(node);\n var cmWrapper = this.getWrapperElement();\n
else\n \n
info.wrapper.insertBefore(node, info.wrapper.firstChild);\n if (options.after instanceof Panel && !options.after.cleared) {\n
wrapper.insertBefore(node, options.before.node.nextSibling);\n
} else if (options.before instanceof Panel && !options.before.cleared) {\n
wrapper.insertBefore(node, options.before.node);\n
} else if (options.replace instanceof Panel && !options.replace.cleared) {\n
wrapper.insertBefore(node, options.replace.node);\n
options.replace.clear();\n
} else if (options.position == "bottom") {\n
wrapper.appendChild(node);\n
} else if (options.position == "before-bottom") {\n
wrapper.insertBefore(node, cmWrapper.nextSibling);\n
} else if (options.position == "after-top") {\n
wrapper.insertBefore(node, cmWrapper);\n
} else {\n
wrapper.insertBefore(node, wrapper.firstChild);\n
}\n
\n
var height = (options && options.height) || node.offsetHeight;\n var height = (options && options.height) || node.offsetHeight;\n
this._setSize(null, info.heightLeft -= height);\n this._setSize(null, info.heightLeft -= height);\n
info.panels++;\n info.panels++;\n
...@@ -130,7 +148,7 @@ ...@@ -130,7 +148,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>3102</int> </value> <value> <int>3844</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897116.97</string> </value> <value> <string>ts60604372.61</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -42,10 +42,12 @@ ...@@ -42,10 +42,12 @@
if (val && !prev) {\n if (val && !prev) {\n
cm.on("blur", onBlur);\n cm.on("blur", onBlur);\n
cm.on("change", onChange);\n cm.on("change", onChange);\n
cm.on("swapDoc", onChange);\n
onChange(cm);\n onChange(cm);\n
} else if (!val && prev) {\n } else if (!val && prev) {\n
cm.off("blur", onBlur);\n cm.off("blur", onBlur);\n
cm.off("change", onChange);\n cm.off("change", onChange);\n
cm.off("swapDoc", onChange);\n
clearPlaceholder(cm);\n clearPlaceholder(cm);\n
var wrapper = cm.getWrapperElement();\n var wrapper = cm.getWrapperElement();\n
wrapper.className = wrapper.className.replace(" CodeMirror-empty", "");\n wrapper.className = wrapper.className.replace(" CodeMirror-empty", "");\n
...@@ -65,7 +67,9 @@ ...@@ -65,7 +67,9 @@
var elt = cm.state.placeholder = document.createElement("pre");\n var elt = cm.state.placeholder = document.createElement("pre");\n
elt.style.cssText = "height: 0; overflow: visible";\n elt.style.cssText = "height: 0; overflow: visible";\n
elt.className = "CodeMirror-placeholder";\n elt.className = "CodeMirror-placeholder";\n
elt.appendChild(document.createTextNode(cm.getOption("placeholder")));\n var placeHolder = cm.getOption("placeholder")\n
if (typeof placeHolder == "string") placeHolder = document.createTextNode(placeHolder)\n
elt.appendChild(placeHolder)\n
cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild);\n cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild);\n
}\n }\n
\n \n
...@@ -94,7 +98,7 @@ ...@@ -94,7 +98,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>1971</int> </value> <value> <int>2139</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897117.47</string> </value> <value> <string>ts60604372.67</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
for (var i = 0; i < val.length; i++) {\n for (var i = 0; i < val.length; i++) {\n
var elt = document.createElement("div");\n var elt = document.createElement("div");\n
elt.className = "CodeMirror-ruler";\n elt.className = "CodeMirror-ruler";\n
var col, cls = null, conf = val[i];\n var col, conf = val[i];\n
if (typeof conf == "number") {\n if (typeof conf == "number") {\n
col = conf;\n col = conf;\n
} else {\n } else {\n
...@@ -75,7 +75,6 @@ ...@@ -75,7 +75,6 @@
if (conf.color) elt.style.borderColor = conf.color;\n if (conf.color) elt.style.borderColor = conf.color;\n
if (conf.lineStyle) elt.style.borderLeftStyle = conf.lineStyle;\n if (conf.lineStyle) elt.style.borderLeftStyle = conf.lineStyle;\n
if (conf.width) elt.style.borderLeftWidth = conf.width;\n if (conf.width) elt.style.borderLeftWidth = conf.width;\n
cls = val[i].className;\n
}\n }\n
elt.style.left = (left + col * cw) + "px";\n elt.style.left = (left + col * cw) + "px";\n
elt.style.top = "-50px";\n elt.style.top = "-50px";\n
...@@ -100,7 +99,7 @@ ...@@ -100,7 +99,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>2134</int> </value> <value> <int>2090</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897116.87</string> </value> <value> <string>ts60604372.72</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897116.29</string> </value> <value> <string>ts60604372.78</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -56,7 +56,9 @@ CodeMirror.registerGlobalHelper("fold", "comment", function(mode) {\n ...@@ -56,7 +56,9 @@ CodeMirror.registerGlobalHelper("fold", "comment", function(mode) {\n
continue;\n continue;\n
}\n }\n
if (pass == 1 && found < start.ch) return;\n if (pass == 1 && found < start.ch) return;\n
if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1)))) {\n if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1))) &&\n
(lineText.slice(found - endToken.length, found) == endToken ||\n
!/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found))))) {\n
startCh = found + startToken.length;\n startCh = found + startToken.length;\n
break;\n break;\n
}\n }\n
...@@ -93,7 +95,7 @@ CodeMirror.registerGlobalHelper("fold", "comment", function(mode) {\n ...@@ -93,7 +95,7 @@ CodeMirror.registerGlobalHelper("fold", "comment", function(mode) {\n
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>1999</int> </value> <value> <int>2147</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897116.45</string> </value> <value> <string>ts60604372.84</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -170,6 +170,10 @@ ...@@ -170,6 +170,10 @@
return editorOptions[name];\n return editorOptions[name];\n
return defaultOptions[name];\n return defaultOptions[name];\n
}\n }\n
\n
CodeMirror.defineExtension("foldOption", function(options, name) {\n
return getOption(this, options, name);\n
});\n
});\n });\n
...@@ -181,7 +185,7 @@ ...@@ -181,7 +185,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>4574</int> </value> <value> <int>4693</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897116.36</string> </value> <value> <string>ts60604372.95</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
cm.off("viewportChange", onViewportChange);\n cm.off("viewportChange", onViewportChange);\n
cm.off("fold", onFold);\n cm.off("fold", onFold);\n
cm.off("unfold", onFold);\n cm.off("unfold", onFold);\n
cm.off("swapDoc", updateInViewport);\n cm.off("swapDoc", onChange);\n
}\n }\n
if (val) {\n if (val) {\n
cm.state.foldGutter = new State(parseOptions(val));\n cm.state.foldGutter = new State(parseOptions(val));\n
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
cm.on("viewportChange", onViewportChange);\n cm.on("viewportChange", onViewportChange);\n
cm.on("fold", onFold);\n cm.on("fold", onFold);\n
cm.on("unfold", onFold);\n cm.on("unfold", onFold);\n
cm.on("swapDoc", updateInViewport);\n cm.on("swapDoc", onChange);\n
}\n }\n
});\n });\n
\n \n
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
function isFolded(cm, line) {\n function isFolded(cm, line) {\n
var marks = cm.findMarksAt(Pos(line));\n var marks = cm.findMarksAt(Pos(line));\n
for (var i = 0; i < marks.length; ++i)\n for (var i = 0; i < marks.length; ++i)\n
if (marks[i].__isFold && marks[i].find().from.line == line) return true;\n if (marks[i].__isFold && marks[i].find().from.line == line) return marks[i];\n
}\n }\n
\n \n
function marker(spec) {\n function marker(spec) {\n
...@@ -95,14 +95,16 @@ ...@@ -95,14 +95,16 @@
\n \n
function updateFoldInfo(cm, from, to) {\n function updateFoldInfo(cm, from, to) {\n
var opts = cm.state.foldGutter.options, cur = from;\n var opts = cm.state.foldGutter.options, cur = from;\n
var minSize = cm.foldOption(opts, "minFoldSize");\n
var func = cm.foldOption(opts, "rangeFinder");\n
cm.eachLine(from, to, function(line) {\n cm.eachLine(from, to, function(line) {\n
var mark = null;\n var mark = null;\n
if (isFolded(cm, cur)) {\n if (isFolded(cm, cur)) {\n
mark = marker(opts.indicatorFolded);\n mark = marker(opts.indicatorFolded);\n
} else {\n } else {\n
var pos = Pos(cur, 0), func = opts.rangeFinder || CodeMirror.fold.auto;\n var pos = Pos(cur, 0);\n
var range = func && func(cm, pos);\n var range = func && func(cm, pos);\n
if (range && range.from.line + 1 < range.to.line)\n if (range && range.to.line - range.from.line >= minSize)\n
mark = marker(opts.indicatorOpen);\n mark = marker(opts.indicatorOpen);\n
}\n }\n
cm.setGutterMarker(line, opts.gutter, mark);\n cm.setGutterMarker(line, opts.gutter, mark);\n
...@@ -120,20 +122,28 @@ ...@@ -120,20 +122,28 @@
}\n }\n
\n \n
function onGutterClick(cm, line, gutter) {\n function onGutterClick(cm, line, gutter) {\n
var opts = cm.state.foldGutter.options;\n var state = cm.state.foldGutter;\n
if (!state) return;\n
var opts = state.options;\n
if (gutter != opts.gutter) return;\n if (gutter != opts.gutter) return;\n
cm.foldCode(Pos(line, 0), opts.rangeFinder);\n var folded = isFolded(cm, line);\n
if (folded) folded.clear();\n
else cm.foldCode(Pos(line, 0), opts.rangeFinder);\n
}\n }\n
\n \n
function onChange(cm) {\n function onChange(cm) {\n
var state = cm.state.foldGutter, opts = cm.state.foldGutter.options;\n var state = cm.state.foldGutter;\n
if (!state) return;\n
var opts = state.options;\n
state.from = state.to = 0;\n state.from = state.to = 0;\n
clearTimeout(state.changeUpdate);\n clearTimeout(state.changeUpdate);\n
state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600);\n state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600);\n
}\n }\n
\n \n
function onViewportChange(cm) {\n function onViewportChange(cm) {\n
var state = cm.state.foldGutter, opts = cm.state.foldGutter.options;\n var state = cm.state.foldGutter;\n
if (!state) return;\n
var opts = state.options;\n
clearTimeout(state.changeUpdate);\n clearTimeout(state.changeUpdate);\n
state.changeUpdate = setTimeout(function() {\n state.changeUpdate = setTimeout(function() {\n
var vp = cm.getViewport();\n var vp = cm.getViewport();\n
...@@ -155,7 +165,9 @@ ...@@ -155,7 +165,9 @@
}\n }\n
\n \n
function onFold(cm, from) {\n function onFold(cm, from) {\n
var state = cm.state.foldGutter, line = from.line;\n var state = cm.state.foldGutter;\n
if (!state) return;\n
var line = from.line;\n
if (line >= state.from && line < state.to)\n if (line >= state.from && line < state.to)\n
updateFoldInfo(cm, line, line + 1);\n updateFoldInfo(cm, line, line + 1);\n
}\n }\n
...@@ -170,7 +182,7 @@ ...@@ -170,7 +182,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>4372</int> </value> <value> <int>4612</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897116.2</string> </value> <value> <string>ts60604373.0</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897116.73</string> </value> <value> <string>ts60604373.06</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897116.59</string> </value> <value> <string>ts60604373.08</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -202,7 +202,7 @@ ...@@ -202,7 +202,7 @@
}\n }\n
};\n };\n
\n \n
// Used by addon/edit/closetag.js\n // Used by addon/cm_edit/closetag.js\n
CodeMirror.scanForClosingTag = function(cm, pos, name, end) {\n CodeMirror.scanForClosingTag = function(cm, pos, name, end) {\n
var iter = new Iter(cm, pos.line, pos.ch, end ? {from: 0, to: end} : null);\n var iter = new Iter(cm, pos.line, pos.ch, end ? {from: 0, to: end} : null);\n
return findMatchingClose(iter, name);\n return findMatchingClose(iter, name);\n
...@@ -218,7 +218,7 @@ ...@@ -218,7 +218,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>6570</int> </value> <value> <int>6573</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897118.73</string> </value> <value> <string>ts60604373.14</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
while (start && word.test(curLine.charAt(start - 1))) --start;\n while (start && word.test(curLine.charAt(start - 1))) --start;\n
var curWord = start != end && curLine.slice(start, end);\n var curWord = start != end && curLine.slice(start, end);\n
\n \n
var list = [], seen = {};\n var list = options && options.list || [], seen = {};\n
var re = new RegExp(word.source, "g");\n var re = new RegExp(word.source, "g");\n
for (var dir = -1; dir <= 1; dir += 2) {\n for (var dir = -1; dir <= 1; dir += 2) {\n
var line = cur.line, endLine = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir;\n var line = cur.line, endLine = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir;\n
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>1653</int> </value> <value> <int>1680</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897119.18</string> </value> <value> <string>ts60604373.19</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -47,6 +47,10 @@ ...@@ -47,6 +47,10 @@
var cur = cm.getCursor(), token = cm.getTokenAt(cur);\n var cur = cm.getCursor(), token = cm.getTokenAt(cur);\n
var inner = CodeMirror.innerMode(cm.getMode(), token.state);\n var inner = CodeMirror.innerMode(cm.getMode(), token.state);\n
if (inner.mode.name != "css") return;\n if (inner.mode.name != "css") return;\n
\n
if (token.type == "keyword" && "!important".indexOf(token.string) == 0)\n
return {list: ["!important"], from: CodeMirror.Pos(cur.line, token.start),\n
to: CodeMirror.Pos(cur.line, token.end)};\n
\n \n
var start = token.start, end = cur.ch, word = token.string.slice(0, end - start);\n var start = token.start, end = cur.ch, word = token.string.slice(0, end - start);\n
if (/[^\\w$_-]/.test(word)) {\n if (/[^\\w$_-]/.test(word)) {\n
...@@ -92,7 +96,7 @@ ...@@ -92,7 +96,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>1951</int> </value> <value> <int>2165</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897119.52</string> </value> <value> <string>ts60604373.25</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897119.08</string> </value> <value> <string>ts60604373.27</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897119.32</string> </value> <value> <string>ts60604373.45</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -47,78 +47,154 @@ ...@@ -47,78 +47,154 @@
ALIAS_KEYWORD: "AS"\n ALIAS_KEYWORD: "AS"\n
};\n };\n
var Pos = CodeMirror.Pos;\n var Pos = CodeMirror.Pos;\n
\n
function isArray(val) { return Object.prototype.toString.call(val) == "[object Array]" }\n
\n \n
function getKeywords(editor) {\n function getKeywords(editor) {\n
var mode = editor.doc.modeOption;\n var mode = editor.doc.modeOption;\n
if (mode === "sql") mode = "text/x-sql";\n if (mode === "sql") mode = "text/x-sql";\n
return CodeMirror.resolveMode(mode).keywords;\n return CodeMirror.resolveMode(mode).keywords;\n
}\n }\n
\n
function getText(item) {\n
return typeof item == "string" ? item : item.text;\n
}\n
\n
function wrapTable(name, value) {\n
if (isArray(value)) value = {columns: value}\n
if (!value.text) value.text = name\n
return value\n
}\n
\n
function parseTables(input) {\n
var result = {}\n
if (isArray(input)) {\n
for (var i = input.length - 1; i >= 0; i--) {\n
var item = input[i]\n
result[getText(item).toUpperCase()] = wrapTable(getText(item), item)\n
}\n
} else if (input) {\n
for (var name in input)\n
result[name.toUpperCase()] = wrapTable(name, input[name])\n
}\n
return result\n
}\n
\n
function getTable(name) {\n
return tables[name.toUpperCase()]\n
}\n
\n
function shallowClone(object) {\n
var result = {};\n
for (var key in object) if (object.hasOwnProperty(key))\n
result[key] = object[key];\n
return result;\n
}\n
\n \n
function match(string, word) {\n function match(string, word) {\n
var len = string.length;\n var len = string.length;\n
var sub = word.substr(0, len);\n var sub = getText(word).substr(0, len);\n
return string.toUpperCase() === sub.toUpperCase();\n return string.toUpperCase() === sub.toUpperCase();\n
}\n }\n
\n \n
function addMatches(result, search, wordlist, formatter) {\n function addMatches(result, search, wordlist, formatter) {\n
for (var word in wordlist) {\n if (isArray(wordlist)) {\n
if (!wordlist.hasOwnProperty(word)) continue;\n for (var i = 0; i < wordlist.length; i++)\n
if (Array.isArray(wordlist)) {\n if (match(search, wordlist[i])) result.push(formatter(wordlist[i]))\n
word = wordlist[word];\n } else {\n
}\n for (var word in wordlist) if (wordlist.hasOwnProperty(word)) {\n
if (match(search, word)) {\n var val = wordlist[word]\n
result.push(formatter(word));\n if (!val || val === true)\n
val = word\n
else\n
val = val.displayText ? {text: val.text, displayText: val.displayText} : val.text\n
if (match(search, val)) result.push(formatter(val))\n
}\n }\n
}\n }\n
}\n }\n
\n \n
function nameCompletion(cur, token, result, editor) {\n function cleanName(name) {\n
var useBacktick = (token.string.charAt(0) == "`");\n // Get rid name from backticks(`) and preceding dot(.)\n
var string = token.string.substr(1);\n if (name.charAt(0) == ".") {\n
var prevToken = editor.getTokenAt(Pos(cur.line, token.start));\n name = name.substr(1);\n
if (token.string.charAt(0) == "." || prevToken.string == "."){\n
//Suggest colunm names\n
if (prevToken.string == ".") {\n
var prevToken = editor.getTokenAt(Pos(cur.line, token.start - 1));\n
}\n
var table = prevToken.string;\n
//Check if backtick is used in table name. If yes, use it for columns too.\n
var useBacktickTable = false;\n
if (table.match(/`/g)) {\n
useBacktickTable = true;\n
table = table.replace(/`/g, "");\n
}\n
//Check if table is available. If not, find table by Alias\n
if (!tables.hasOwnProperty(table))\n
table = findTableByAlias(table, editor);\n
var columns = tables[table];\n
if (!columns) return;\n
\n
if (useBacktick) {\n
addMatches(result, string, columns, function(w) {return "`" + w + "`";});\n
}\n }\n
else if(useBacktickTable) {\n return name.replace(/`/g, "");\n
addMatches(result, string, columns, function(w) {return ".`" + w + "`";});\n
}\n }\n
else {\n \n
addMatches(result, string, columns, function(w) {return "." + w;});\n function insertBackticks(name) {\n
var nameParts = getText(name).split(".");\n
for (var i = 0; i < nameParts.length; i++)\n
nameParts[i] = "`" + nameParts[i] + "`";\n
var escaped = nameParts.join(".");\n
if (typeof name == "string") return escaped;\n
name = shallowClone(name);\n
name.text = escaped;\n
return name;\n
}\n }\n
\n
function nameCompletion(cur, token, result, editor) {\n
// Try to complete table, colunm names and return start position of completion\n
var useBacktick = false;\n
var nameParts = [];\n
var start = token.start;\n
var cont = true;\n
while (cont) {\n
cont = (token.string.charAt(0) == ".");\n
useBacktick = useBacktick || (token.string.charAt(0) == "`");\n
\n
start = token.start;\n
nameParts.unshift(cleanName(token.string));\n
\n
token = editor.getTokenAt(Pos(cur.line, token.start));\n
if (token.string == ".") {\n
cont = true;\n
token = editor.getTokenAt(Pos(cur.line, token.start));\n
}\n }\n
else {\n
//Suggest table names or colums in defaultTable\n
while (token.start && string.charAt(0) == ".") {\n
token = editor.getTokenAt(Pos(cur.line, token.start - 1));\n
string = token.string + string;\n
}\n }\n
if (useBacktick) {\n \n
addMatches(result, string, tables, function(w) {return "`" + w + "`";});\n // Try to complete table names\n
addMatches(result, string, defaultTable, function(w) {return "`" + w + "`";});\n var string = nameParts.join(".");\n
addMatches(result, string, tables, function(w) {\n
return useBacktick ? insertBackticks(w) : w;\n
});\n
\n
// Try to complete columns from defaultTable\n
addMatches(result, string, defaultTable, function(w) {\n
return useBacktick ? insertBackticks(w) : w;\n
});\n
\n
// Try to complete columns\n
string = nameParts.pop();\n
var table = nameParts.join(".");\n
\n
var alias = false;\n
var aliasTable = table;\n
// Check if table is available. If not, find table by Alias\n
if (!getTable(table)) {\n
var oldTable = table;\n
table = findTableByAlias(table, editor);\n
if (table !== oldTable) alias = true;\n
}\n }\n
else {\n \n
addMatches(result, string, tables, function(w) {return w;});\n var columns = getTable(table);\n
addMatches(result, string, defaultTable, function(w) {return w;});\n if (columns && columns.columns)\n
columns = columns.columns;\n
\n
if (columns) {\n
addMatches(result, string, columns, function(w) {\n
var tableInsert = table;\n
if (alias == true) tableInsert = aliasTable;\n
if (typeof w == "string") {\n
w = tableInsert + "." + w;\n
} else {\n
w = shallowClone(w);\n
w.text = tableInsert + "." + w.text;\n
}\n }\n
return useBacktick ? insertBackticks(w) : w;\n
});\n
}\n }\n
\n
return start;\n
}\n }\n
\n \n
function eachWord(lineText, f) {\n function eachWord(lineText, f) {\n
...@@ -163,7 +239,7 @@ ...@@ -163,7 +239,7 @@
//find valid range\n //find valid range\n
var prevItem = 0;\n var prevItem = 0;\n
var current = convertCurToNumber(editor.getCursor());\n var current = convertCurToNumber(editor.getCursor());\n
for (var i=0; i< separator.length; i++) {\n for (var i = 0; i < separator.length; i++) {\n
var _v = convertCurToNumber(separator[i]);\n var _v = convertCurToNumber(separator[i]);\n
if (current > prevItem && current <= _v) {\n if (current > prevItem && current <= _v) {\n
validRange = { start: convertNumberToCur(prevItem), end: convertNumberToCur(_v) };\n validRange = { start: convertNumberToCur(prevItem), end: convertNumberToCur(_v) };\n
...@@ -178,12 +254,10 @@ ...@@ -178,12 +254,10 @@
var lineText = query[i];\n var lineText = query[i];\n
eachWord(lineText, function(word) {\n eachWord(lineText, function(word) {\n
var wordUpperCase = word.toUpperCase();\n var wordUpperCase = word.toUpperCase();\n
if (wordUpperCase === aliasUpperCase && tables.hasOwnProperty(previousWord)) {\n if (wordUpperCase === aliasUpperCase && getTable(previousWord))\n
table = previousWord;\n table = previousWord;\n
}\n if (wordUpperCase !== CONS.ALIAS_KEYWORD)\n
if (wordUpperCase !== CONS.ALIAS_KEYWORD) {\n
previousWord = word;\n previousWord = word;\n
}\n
});\n });\n
if (table) break;\n if (table) break;\n
}\n }\n
...@@ -191,10 +265,19 @@ ...@@ -191,10 +265,19 @@
}\n }\n
\n \n
CodeMirror.registerHelper("hint", "sql", function(editor, options) {\n CodeMirror.registerHelper("hint", "sql", function(editor, options) {\n
tables = (options && options.tables) || {};\n tables = parseTables(options && options.tables)\n
var defaultTableName = options && options.defaultTable;\n var defaultTableName = options && options.defaultTable;\n
defaultTable = (defaultTableName && tables[defaultTableName] || []);\n var disableKeywords = options && options.disableKeywords;\n
defaultTable = defaultTableName && getTable(defaultTableName);\n
keywords = keywords || getKeywords(editor);\n keywords = keywords || getKeywords(editor);\n
\n
if (defaultTableName && !defaultTable)\n
defaultTable = findTableByAlias(defaultTableName, editor);\n
\n
defaultTable = defaultTable || [];\n
\n
if (defaultTable.columns)\n
defaultTable = defaultTable.columns;\n
\n \n
var cur = editor.getCursor();\n var cur = editor.getCursor();\n
var result = [];\n var result = [];\n
...@@ -213,10 +296,11 @@ ...@@ -213,10 +296,11 @@
search = "";\n search = "";\n
}\n }\n
if (search.charAt(0) == "." || search.charAt(0) == "`") {\n if (search.charAt(0) == "." || search.charAt(0) == "`") {\n
nameCompletion(cur, token, result, editor);\n start = nameCompletion(cur, token, result, editor);\n
} else {\n } else {\n
addMatches(result, search, tables, function(w) {return w;});\n addMatches(result, search, tables, function(w) {return w;});\n
addMatches(result, search, defaultTable, function(w) {return w;});\n addMatches(result, search, defaultTable, function(w) {return w;});\n
if (!disableKeywords)\n
addMatches(result, search, keywords, function(w) {return w.toUpperCase();});\n addMatches(result, search, keywords, function(w) {return w.toUpperCase();});\n
}\n }\n
\n \n
...@@ -233,7 +317,7 @@ ...@@ -233,7 +317,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>6499</int> </value> <value> <int>8578</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897118.97</string> </value> <value> <string>ts60604373.5</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897121.01</string> </value> <value> <string>ts60604373.56</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21898625.13</string> </value> <value> <string>ts60604373.61</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts60604373.67</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>html-lint.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>data</string> </key>
<value> <string encoding="cdata"><![CDATA[
// CodeMirror, copyright (c) by Marijn Haverbeke and others\n
// Distributed under an MIT license: http://codemirror.net/LICENSE\n
\n
// Depends on htmlhint.js from http://htmlhint.com/js/htmlhint.js\n
\n
// declare global: HTMLHint\n
\n
(function(mod) {\n
if (typeof exports == "object" && typeof module == "object") // CommonJS\n
mod(require("../../lib/codemirror"), require("htmlhint"));\n
else if (typeof define == "function" && define.amd) // AMD\n
define(["../../lib/codemirror", "htmlhint"], mod);\n
else // Plain browser env\n
mod(CodeMirror);\n
})(function(CodeMirror) {\n
"use strict";\n
\n
var defaultRules = {\n
"tagname-lowercase": true,\n
"attr-lowercase": true,\n
"attr-value-double-quotes": true,\n
"doctype-first": false,\n
"tag-pair": true,\n
"spec-char-escape": true,\n
"id-unique": true,\n
"src-not-empty": true,\n
"attr-no-duplication": true\n
};\n
\n
CodeMirror.registerHelper("lint", "html", function(text, options) {\n
var found = [];\n
if (!window.HTMLHint) return found;\n
var messages = HTMLHint.verify(text, options && options.rules || defaultRules);\n
for (var i = 0; i < messages.length; i++) {\n
var message = messages[i];\n
var startLine = message.line - 1, endLine = message.line - 1, startCol = message.col - 1, endCol = message.col;\n
found.push({\n
from: CodeMirror.Pos(startLine, startCol),\n
to: CodeMirror.Pos(endLine, endCol),\n
message: message.message,\n
severity : message.type\n
});\n
}\n
return found;\n
});\n
});\n
]]></string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>1513</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897120.51</string> </value> <value> <string>ts60604373.73</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
\n \n
function validator(text, options) {\n function validator(text, options) {\n
if (!window.JSHINT) return [];\n if (!window.JSHINT) return [];\n
JSHINT(text, options);\n JSHINT(text, options, options.globals);\n
var errors = JSHINT.data().errors, result = [];\n var errors = JSHINT.data().errors, result = [];\n
if (errors) parseErrors(errors, result);\n if (errors) parseErrors(errors, result);\n
return result;\n return result;\n
...@@ -172,7 +172,7 @@ ...@@ -172,7 +172,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>4452</int> </value> <value> <int>4469</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897120.37</string> </value> <value> <string>ts60604373.79</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21898385.1</string> </value> <value> <string>ts60604373.9</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
}\n }\n
var poll = setInterval(function() {\n var poll = setInterval(function() {\n
if (tooltip) for (var n = node;; n = n.parentNode) {\n if (tooltip) for (var n = node;; n = n.parentNode) {\n
if (n && n.nodeType == 11) n = n.host;\n
if (n == document.body) return;\n if (n == document.body) return;\n
if (!n) { hide(); break; }\n if (!n) { hide(); break; }\n
}\n }\n
...@@ -88,13 +89,12 @@ ...@@ -88,13 +89,12 @@
this.timeout = null;\n this.timeout = null;\n
this.hasGutter = hasGutter;\n this.hasGutter = hasGutter;\n
this.onMouseOver = function(e) { onMouseOver(cm, e); };\n this.onMouseOver = function(e) { onMouseOver(cm, e); };\n
this.waitingFor = 0\n
}\n }\n
\n \n
function parseOptions(cm, options) {\n function parseOptions(_cm, options) {\n
if (options instanceof Function) return {getAnnotations: options};\n if (options instanceof Function) return {getAnnotations: options};\n
if (!options || options === true) options = {};\n if (!options || options === true) options = {};\n
if (!options.getAnnotations) options.getAnnotations = cm.getHelper(CodeMirror.Pos(0, 0), "lint");\n
if (!options.getAnnotations) throw new Error("Required option \'getAnnotations\' missing (lint addon)");\n
return options;\n return options;\n
}\n }\n
\n \n
...@@ -143,14 +143,33 @@ ...@@ -143,14 +143,33 @@
tip.appendChild(document.createTextNode(ann.message));\n tip.appendChild(document.createTextNode(ann.message));\n
return tip;\n return tip;\n
}\n }\n
\n
function lintAsync(cm, getAnnotations, passOptions) {\n
var state = cm.state.lint\n
var id = ++state.waitingFor\n
function abort() {\n
id = -1\n
cm.off("change", abort)\n
}\n
cm.on("change", abort)\n
getAnnotations(cm.getValue(), function(annotations, arg2) {\n
cm.off("change", abort)\n
if (state.waitingFor != id) return\n
if (arg2 && annotations instanceof CodeMirror) annotations = arg2\n
updateLinting(cm, annotations)\n
}, passOptions, cm);\n
}\n
\n \n
function startLinting(cm) {\n function startLinting(cm) {\n
var state = cm.state.lint, options = state.options;\n var state = cm.state.lint, options = state.options;\n
var passOptions = options.options || options; // Support deprecated passing of `options` property in options\n var passOptions = options.options || options; // Support deprecated passing of `options` property in options\n
if (options.async)\n var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint");\n
options.getAnnotations(cm.getValue(), updateLinting, passOptions, cm);\n if (!getAnnotations) return;\n
else\n if (options.async || getAnnotations.async) {\n
updateLinting(cm, options.getAnnotations(cm.getValue(), passOptions, cm));\n lintAsync(cm, getAnnotations, passOptions)\n
} else {\n
updateLinting(cm, getAnnotations(cm.getValue(), passOptions, cm));\n
}\n
}\n }\n
\n \n
function updateLinting(cm, annotationsNotSorted) {\n function updateLinting(cm, annotationsNotSorted) {\n
...@@ -190,13 +209,19 @@ ...@@ -190,13 +209,19 @@
\n \n
function onChange(cm) {\n function onChange(cm) {\n
var state = cm.state.lint;\n var state = cm.state.lint;\n
if (!state) return;\n
clearTimeout(state.timeout);\n clearTimeout(state.timeout);\n
state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500);\n state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500);\n
}\n }\n
\n \n
function popupSpanTooltip(ann, e) {\n function popupTooltips(annotations, e) {\n
var target = e.target || e.srcElement;\n var target = e.target || e.srcElement;\n
showTooltipFor(e, annotationTooltip(ann), target);\n var tooltip = document.createDocumentFragment();\n
for (var i = 0; i < annotations.length; i++) {\n
var ann = annotations[i];\n
tooltip.appendChild(annotationTooltip(ann));\n
}\n
showTooltipFor(e, tooltip, target);\n
}\n }\n
\n \n
function onMouseOver(cm, e) {\n function onMouseOver(cm, e) {\n
...@@ -204,17 +229,21 @@ ...@@ -204,17 +229,21 @@
if (!/\\bCodeMirror-lint-mark-/.test(target.className)) return;\n if (!/\\bCodeMirror-lint-mark-/.test(target.className)) return;\n
var box = target.getBoundingClientRect(), x = (box.left + box.right) / 2, y = (box.top + box.bottom) / 2;\n var box = target.getBoundingClientRect(), x = (box.left + box.right) / 2, y = (box.top + box.bottom) / 2;\n
var spans = cm.findMarksAt(cm.coordsChar({left: x, top: y}, "client"));\n var spans = cm.findMarksAt(cm.coordsChar({left: x, top: y}, "client"));\n
\n
var annotations = [];\n
for (var i = 0; i < spans.length; ++i) {\n for (var i = 0; i < spans.length; ++i) {\n
var ann = spans[i].__annotation;\n annotations.push(spans[i].__annotation);\n
if (ann) return popupSpanTooltip(ann, e);\n
}\n }\n
if (annotations.length) popupTooltips(annotations, e);\n
}\n }\n
\n \n
CodeMirror.defineOption("lint", false, function(cm, val, old) {\n CodeMirror.defineOption("lint", false, function(cm, val, old) {\n
if (old && old != CodeMirror.Init) {\n if (old && old != CodeMirror.Init) {\n
clearMarks(cm);\n clearMarks(cm);\n
if (cm.state.lint.options.lintOnChange !== false)\n
cm.off("change", onChange);\n cm.off("change", onChange);\n
CodeMirror.off(cm.getWrapperElement(), "mouseover", cm.state.lint.onMouseOver);\n CodeMirror.off(cm.getWrapperElement(), "mouseover", cm.state.lint.onMouseOver);\n
clearTimeout(cm.state.lint.timeout);\n
delete cm.state.lint;\n delete cm.state.lint;\n
}\n }\n
\n \n
...@@ -222,6 +251,7 @@ ...@@ -222,6 +251,7 @@
var gutters = cm.getOption("gutters"), hasLintGutter = false;\n var gutters = cm.getOption("gutters"), hasLintGutter = false;\n
for (var i = 0; i < gutters.length; ++i) if (gutters[i] == GUTTER_ID) hasLintGutter = true;\n for (var i = 0; i < gutters.length; ++i) if (gutters[i] == GUTTER_ID) hasLintGutter = true;\n
var state = cm.state.lint = new LintState(cm, parseOptions(cm, val), hasLintGutter);\n var state = cm.state.lint = new LintState(cm, parseOptions(cm, val), hasLintGutter);\n
if (state.options.lintOnChange !== false)\n
cm.on("change", onChange);\n cm.on("change", onChange);\n
if (state.options.tooltips != false)\n if (state.options.tooltips != false)\n
CodeMirror.on(cm.getWrapperElement(), "mouseover", state.onMouseOver);\n CodeMirror.on(cm.getWrapperElement(), "mouseover", state.onMouseOver);\n
...@@ -229,6 +259,10 @@ ...@@ -229,6 +259,10 @@
startLinting(cm);\n startLinting(cm);\n
}\n }\n
});\n });\n
\n
CodeMirror.defineExtension("performLint", function() {\n
if (this.state.lint) startLinting(this);\n
});\n
});\n });\n
...@@ -240,7 +274,7 @@ ...@@ -240,7 +274,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>7036</int> </value> <value> <int>8032</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897120.75</string> </value> <value> <string>ts60604373.96</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -90,6 +90,7 @@ ...@@ -90,6 +90,7 @@
position: absolute;\n position: absolute;\n
cursor: pointer;\n cursor: pointer;\n
color: #44c;\n color: #44c;\n
z-index: 3;\n
}\n }\n
\n \n
.CodeMirror-merge-copy-reverse {\n .CodeMirror-merge-copy-reverse {\n
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897115.91</string> </value> <value> <string>ts60604374.14</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897116.0</string> </value> <value> <string>ts60604374.15</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -42,12 +42,14 @@ ...@@ -42,12 +42,14 @@
CodeMirror.multiplexingMode = function(outer /*, others */) {\n CodeMirror.multiplexingMode = function(outer /*, others */) {\n
// Others should be {open, close, mode [, delimStyle] [, innerStyle]} objects\n // Others should be {open, close, mode [, delimStyle] [, innerStyle]} objects\n
var others = Array.prototype.slice.call(arguments, 1);\n var others = Array.prototype.slice.call(arguments, 1);\n
var n_others = others.length;\n
\n \n
function indexOf(string, pattern, from) {\n function indexOf(string, pattern, from, returnEnd) {\n
if (typeof pattern == "string") return string.indexOf(pattern, from);\n if (typeof pattern == "string") {\n
var found = string.indexOf(pattern, from);\n
return returnEnd && found > -1 ? found + pattern.length : found;\n
}\n
var m = pattern.exec(from ? string.slice(from) : string);\n var m = pattern.exec(from ? string.slice(from) : string);\n
return m ? m.index + from : -1;\n return m ? m.index + from + (returnEnd ? m[0].length : 0) : -1;\n
}\n }\n
\n \n
return {\n return {\n
...@@ -70,14 +72,14 @@ CodeMirror.multiplexingMode = function(outer /*, others */) {\n ...@@ -70,14 +72,14 @@ CodeMirror.multiplexingMode = function(outer /*, others */) {\n
token: function(stream, state) {\n token: function(stream, state) {\n
if (!state.innerActive) {\n if (!state.innerActive) {\n
var cutOff = Infinity, oldContent = stream.string;\n var cutOff = Infinity, oldContent = stream.string;\n
for (var i = 0; i < n_others; ++i) {\n for (var i = 0; i < others.length; ++i) {\n
var other = others[i];\n var other = others[i];\n
var found = indexOf(oldContent, other.open, stream.pos);\n var found = indexOf(oldContent, other.open, stream.pos);\n
if (found == stream.pos) {\n if (found == stream.pos) {\n
stream.match(other.open);\n if (!other.parseDelimiters) stream.match(other.open);\n
state.innerActive = other;\n state.innerActive = other;\n
state.inner = CodeMirror.startState(other.mode, outer.indent ? outer.indent(state.outer, "") : 0);\n state.inner = CodeMirror.startState(other.mode, outer.indent ? outer.indent(state.outer, "") : 0);\n
return other.delimStyle;\n return other.delimStyle && (other.delimStyle + " " + other.delimStyle + "-open");\n
} else if (found != -1 && found < cutOff) {\n } else if (found != -1 && found < cutOff) {\n
cutOff = found;\n cutOff = found;\n
}\n }\n
...@@ -92,18 +94,21 @@ CodeMirror.multiplexingMode = function(outer /*, others */) {\n ...@@ -92,18 +94,21 @@ CodeMirror.multiplexingMode = function(outer /*, others */) {\n
state.innerActive = state.inner = null;\n state.innerActive = state.inner = null;\n
return this.token(stream, state);\n return this.token(stream, state);\n
}\n }\n
var found = curInner.close ? indexOf(oldContent, curInner.close, stream.pos) : -1;\n var found = curInner.close ? indexOf(oldContent, curInner.close, stream.pos, curInner.parseDelimiters) : -1;\n
if (found == stream.pos) {\n if (found == stream.pos && !curInner.parseDelimiters) {\n
stream.match(curInner.close);\n stream.match(curInner.close);\n
state.innerActive = state.inner = null;\n state.innerActive = state.inner = null;\n
return curInner.delimStyle;\n return curInner.delimStyle && (curInner.delimStyle + " " + curInner.delimStyle + "-close");\n
}\n }\n
if (found > -1) stream.string = oldContent.slice(0, found);\n if (found > -1) stream.string = oldContent.slice(0, found);\n
var innerToken = curInner.mode.token(stream, state.inner);\n var innerToken = curInner.mode.token(stream, state.inner);\n
if (found > -1) stream.string = oldContent;\n if (found > -1) stream.string = oldContent;\n
\n
if (found == stream.pos && curInner.parseDelimiters)\n
state.innerActive = state.inner = null;\n
\n \n
if (curInner.innerStyle) {\n if (curInner.innerStyle) {\n
if (innerToken) innerToken = innerToken + \' \' + curInner.innerStyle;\n if (innerToken) innerToken = innerToken + " " + curInner.innerStyle;\n
else innerToken = curInner.innerStyle;\n else innerToken = curInner.innerStyle;\n
}\n }\n
\n \n
...@@ -123,7 +128,7 @@ CodeMirror.multiplexingMode = function(outer /*, others */) {\n ...@@ -123,7 +128,7 @@ CodeMirror.multiplexingMode = function(outer /*, others */) {\n
mode.blankLine(state.innerActive ? state.inner : state.outer);\n mode.blankLine(state.innerActive ? state.inner : state.outer);\n
}\n }\n
if (!state.innerActive) {\n if (!state.innerActive) {\n
for (var i = 0; i < n_others; ++i) {\n for (var i = 0; i < others.length; ++i) {\n
var other = others[i];\n var other = others[i];\n
if (other.open === "\\n") {\n if (other.open === "\\n") {\n
state.innerActive = other;\n state.innerActive = other;\n
...@@ -154,7 +159,7 @@ CodeMirror.multiplexingMode = function(outer /*, others */) {\n ...@@ -154,7 +159,7 @@ CodeMirror.multiplexingMode = function(outer /*, others */) {\n
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>4197</int> </value> <value> <int>4624</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897115.81</string> </value> <value> <string>ts60604374.17</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
\n \n
MT(\n MT(\n
"stexInsideMarkdown",\n "stexInsideMarkdown",\n
"[strong **Equation:**] [delim $][inner&tag \\\\pi][delim $]");\n "[strong **Equation:**] [delim&delim-open $][inner&tag \\\\pi][delim&delim-close $]");\n
})();\n })();\n
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>810</int> </value> <value> <int>833</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897115.72</string> </value> <value> <string>ts60604374.22</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897115.63</string> </value> <value> <string>ts60604374.24</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
\n \n
function ensureState(states, name) {\n function ensureState(states, name) {\n
if (!states.hasOwnProperty(name))\n if (!states.hasOwnProperty(name))\n
throw new Error("Undefined state " + name + "in simple mode");\n throw new Error("Undefined state " + name + " in simple mode");\n
}\n }\n
\n \n
function toRegex(val, caret) {\n function toRegex(val, caret) {\n
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
var curState = states[state.state];\n var curState = states[state.state];\n
for (var i = 0; i < curState.length; i++) {\n for (var i = 0; i < curState.length; i++) {\n
var rule = curState[i];\n var rule = curState[i];\n
var matches = stream.match(rule.regex);\n var matches = (!rule.data.sol || stream.sol()) && stream.match(rule.regex);\n
if (matches) {\n if (matches) {\n
if (rule.data.next) {\n if (rule.data.next) {\n
state.state = rule.data.next;\n state.state = rule.data.next;\n
...@@ -249,7 +249,7 @@ ...@@ -249,7 +249,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>7862</int> </value> <value> <int>7899</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897122.18</string> </value> <value> <string>ts60604374.3</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897122.07</string> </value> <value> <string>ts60604374.36</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897121.98</string> </value> <value> <string>ts60604374.42</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -44,7 +44,7 @@ CodeMirror.runMode = function(string, modespec, callback, options) {\n ...@@ -44,7 +44,7 @@ CodeMirror.runMode = function(string, modespec, callback, options) {\n
var ie = /MSIE \\d/.test(navigator.userAgent);\n var ie = /MSIE \\d/.test(navigator.userAgent);\n
var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);\n var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);\n
\n \n
if (callback.nodeType == 1) {\n if (callback.appendChild) {\n
var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;\n var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;\n
var node = callback, col = 0;\n var node = callback, col = 0;\n
node.innerHTML = "";\n node.innerHTML = "";\n
...@@ -108,7 +108,7 @@ CodeMirror.runMode = function(string, modespec, callback, options) {\n ...@@ -108,7 +108,7 @@ CodeMirror.runMode = function(string, modespec, callback, options) {\n
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>2501</int> </value> <value> <int>2499</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897122.25</string> </value> <value> <string>ts60604374.47</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -31,19 +31,37 @@ ...@@ -31,19 +31,37 @@
\n \n
/* Just enough of CodeMirror to run runMode under node.js */\n /* Just enough of CodeMirror to run runMode under node.js */\n
\n \n
// declare global: StringStream\n function splitLines(string){return string.split(/\\r\\n?|\\n/);};\n
\n \n
function splitLines(string){ return string.split(/\\r?\\n|\\r/); };\n // Counts the column offset in a string, taking tabs into account.\n
// Used mostly to find indentation.\n
var countColumn = function(string, end, tabSize, startIndex, startValue) {\n
if (end == null) {\n
end = string.search(/[^\\s\\u00a0]/);\n
if (end == -1) end = string.length;\n
}\n
for (var i = startIndex || 0, n = startValue || 0;;) {\n
var nextTab = string.indexOf("\\t", i);\n
if (nextTab < 0 || nextTab >= end)\n
return n + (end - i);\n
n += nextTab - i;\n
n += tabSize - (n % tabSize);\n
i = nextTab + 1;\n
}\n
};\n
\n \n
function StringStream(string) {\n function StringStream(string, tabSize) {\n
this.pos = this.start = 0;\n this.pos = this.start = 0;\n
this.string = string;\n this.string = string;\n
this.tabSize = tabSize || 8;\n
this.lastColumnPos = this.lastColumnValue = 0;\n
this.lineStart = 0;\n this.lineStart = 0;\n
}\n };\n
\n
StringStream.prototype = {\n StringStream.prototype = {\n
eol: function() {return this.pos >= this.string.length;},\n eol: function() {return this.pos >= this.string.length;},\n
sol: function() {return this.pos == 0;},\n sol: function() {return this.pos == this.lineStart;},\n
peek: function() {return this.string.charAt(this.pos) || null;},\n peek: function() {return this.string.charAt(this.pos) || undefined;},\n
next: function() {\n next: function() {\n
if (this.pos < this.string.length)\n if (this.pos < this.string.length)\n
return this.string.charAt(this.pos++);\n return this.string.charAt(this.pos++);\n
...@@ -70,8 +88,17 @@ StringStream.prototype = {\n ...@@ -70,8 +88,17 @@ StringStream.prototype = {\n
if (found > -1) {this.pos = found; return true;}\n if (found > -1) {this.pos = found; return true;}\n
},\n },\n
backUp: function(n) {this.pos -= n;},\n backUp: function(n) {this.pos -= n;},\n
column: function() {return this.start - this.lineStart;},\n column: function() {\n
indentation: function() {return 0;},\n if (this.lastColumnPos < this.start) {\n
this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);\n
this.lastColumnPos = this.start;\n
}\n
return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);\n
},\n
indentation: function() {\n
return countColumn(this.string, null, this.tabSize) -\n
(this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);\n
},\n
match: function(pattern, consume, caseInsensitive) {\n match: function(pattern, consume, caseInsensitive) {\n
if (typeof pattern == "string") {\n if (typeof pattern == "string") {\n
var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};\n var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};\n
...@@ -122,11 +149,42 @@ exports.resolveMode = function(spec) {\n ...@@ -122,11 +149,42 @@ exports.resolveMode = function(spec) {\n
if (typeof spec == "string") return {name: spec};\n if (typeof spec == "string") return {name: spec};\n
else return spec || {name: "null"};\n else return spec || {name: "null"};\n
};\n };\n
\n
function copyObj(obj, target, overwrite) {\n
if (!target) target = {};\n
for (var prop in obj)\n
if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))\n
target[prop] = obj[prop];\n
return target;\n
}\n
\n
// This can be used to attach properties to mode objects from\n
// outside the actual mode definition.\n
var modeExtensions = exports.modeExtensions = {};\n
exports.extendMode = function(mode, properties) {\n
var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});\n
copyObj(properties, exts);\n
};\n
\n
exports.getMode = function(options, spec) {\n exports.getMode = function(options, spec) {\n
spec = exports.resolveMode(spec);\n var spec = exports.resolveMode(spec);\n
var mfactory = modes[spec.name];\n var mfactory = modes[spec.name];\n
if (!mfactory) throw new Error("Unknown mode: " + spec);\n if (!mfactory) return exports.getMode(options, "text/plain");\n
return mfactory(options, spec);\n var modeObj = mfactory(options, spec);\n
if (modeExtensions.hasOwnProperty(spec.name)) {\n
var exts = modeExtensions[spec.name];\n
for (var prop in exts) {\n
if (!exts.hasOwnProperty(prop)) continue;\n
if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop];\n
modeObj[prop] = exts[prop];\n
}\n
}\n
modeObj.name = spec.name;\n
if (spec.helperType) modeObj.helperType = spec.helperType;\n
if (spec.modeProps) for (var prop in spec.modeProps)\n
modeObj[prop] = spec.modeProps[prop];\n
\n
return modeObj;\n
};\n };\n
exports.registerHelper = exports.registerGlobalHelper = Math.min;\n exports.registerHelper = exports.registerGlobalHelper = Math.min;\n
\n \n
...@@ -146,6 +204,7 @@ exports.runMode = function(string, modespec, callback, options) {\n ...@@ -146,6 +204,7 @@ exports.runMode = function(string, modespec, callback, options) {\n
};\n };\n
\n \n
require.cache[require.resolve("../../lib/codemirror")] = require.cache[require.resolve("./runmode.node")];\n require.cache[require.resolve("../../lib/codemirror")] = require.cache[require.resolve("./runmode.node")];\n
require.cache[require.resolve("../../addon/runmode/runmode")] = require.cache[require.resolve("./runmode.node")];\n
]]></string> </value> ]]></string> </value>
...@@ -156,7 +215,7 @@ require.cache[require.resolve("../../lib/codemirror")] = require.cache[require.r ...@@ -156,7 +215,7 @@ require.cache[require.resolve("../../lib/codemirror")] = require.cache[require.r
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>4289</int> </value> <value> <int>6528</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897118.59</string> </value> <value> <string>ts60604374.52</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -39,28 +39,47 @@ ...@@ -39,28 +39,47 @@
})(function(CodeMirror) {\n })(function(CodeMirror) {\n
"use strict";\n "use strict";\n
\n \n
CodeMirror.defineExtension("annotateScrollbar", function(className) {\n CodeMirror.defineExtension("annotateScrollbar", function(options) {\n
return new Annotation(this, className);\n if (typeof options == "string") options = {className: options};\n
return new Annotation(this, options);\n
});\n });\n
\n \n
function Annotation(cm, className) {\n CodeMirror.defineOption("scrollButtonHeight", 0);\n
\n
function Annotation(cm, options) {\n
this.cm = cm;\n this.cm = cm;\n
this.className = className;\n this.options = options;\n
this.buttonHeight = options.scrollButtonHeight || cm.getOption("scrollButtonHeight");\n
this.annotations = [];\n this.annotations = [];\n
this.doRedraw = this.doUpdate = null;\n
this.div = cm.getWrapperElement().appendChild(document.createElement("div"));\n this.div = cm.getWrapperElement().appendChild(document.createElement("div"));\n
this.div.style.cssText = "position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none";\n this.div.style.cssText = "position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none";\n
this.computeScale();\n this.computeScale();\n
\n
function scheduleRedraw(delay) {\n
clearTimeout(self.doRedraw);\n
self.doRedraw = setTimeout(function() { self.redraw(); }, delay);\n
}\n
\n \n
var self = this;\n var self = this;\n
cm.on("refresh", this.resizeHandler = function(){\n cm.on("refresh", this.resizeHandler = function() {\n
if (self.computeScale()) self.redraw();\n clearTimeout(self.doUpdate);\n
self.doUpdate = setTimeout(function() {\n
if (self.computeScale()) scheduleRedraw(20);\n
}, 100);\n
});\n
cm.on("markerAdded", this.resizeHandler);\n
cm.on("markerCleared", this.resizeHandler);\n
if (options.listenForChanges !== false)\n
cm.on("change", this.changeHandler = function() {\n
scheduleRedraw(250);\n
});\n });\n
}\n }\n
\n \n
Annotation.prototype.computeScale = function() {\n Annotation.prototype.computeScale = function() {\n
var cm = this.cm;\n var cm = this.cm;\n
var hScale = (cm.getWrapperElement().clientHeight - cm.display.barHeight) /\n var hScale = (cm.getWrapperElement().clientHeight - cm.display.barHeight - this.buttonHeight * 2) /\n
cm.heightAtLine(cm.lastLine() + 1, "local");\n cm.getScrollerElement().scrollHeight\n
if (hScale != this.hScale) {\n if (hScale != this.hScale) {\n
this.hScale = hScale;\n this.hScale = hScale;\n
return true;\n return true;\n
...@@ -72,26 +91,46 @@ ...@@ -72,26 +91,46 @@
this.redraw();\n this.redraw();\n
};\n };\n
\n \n
Annotation.prototype.redraw = function() {\n Annotation.prototype.redraw = function(compute) {\n
if (compute !== false) this.computeScale();\n
var cm = this.cm, hScale = this.hScale;\n var cm = this.cm, hScale = this.hScale;\n
if (!cm.display.barWidth) return;\n
\n \n
var frag = document.createDocumentFragment(), anns = this.annotations;\n var frag = document.createDocumentFragment(), anns = this.annotations;\n
for (var i = 0, nextTop; i < anns.length; i++) {\n \n
var wrapping = cm.getOption("lineWrapping");\n
var singleLineH = wrapping && cm.defaultTextHeight() * 1.5;\n
var curLine = null, curLineObj = null;\n
function getY(pos, top) {\n
if (curLine != pos.line) {\n
curLine = pos.line;\n
curLineObj = cm.getLineHandle(curLine);\n
}\n
if (wrapping && curLineObj.height > singleLineH)\n
return cm.charCoords(pos, "local")[top ? "top" : "bottom"];\n
var topY = cm.heightAtLine(curLineObj, "local");\n
return topY + (top ? 0 : curLineObj.height);\n
}\n
\n
if (cm.display.barWidth) for (var i = 0, nextTop; i < anns.length; i++) {\n
var ann = anns[i];\n var ann = anns[i];\n
var top = nextTop || cm.charCoords(ann.from, "local").top * hScale;\n var top = nextTop || getY(ann.from, true) * hScale;\n
var bottom = cm.charCoords(ann.to, "local").bottom * hScale;\n var bottom = getY(ann.to, false) * hScale;\n
while (i < anns.length - 1) {\n while (i < anns.length - 1) {\n
nextTop = cm.charCoords(anns[i + 1].from, "local").top * hScale;\n nextTop = getY(anns[i + 1].from, true) * hScale;\n
if (nextTop > bottom + .9) break;\n if (nextTop > bottom + .9) break;\n
ann = anns[++i];\n ann = anns[++i];\n
bottom = cm.charCoords(ann.to, "local").bottom * hScale;\n bottom = getY(ann.to, false) * hScale;\n
}\n }\n
if (bottom == top) continue;\n
var height = Math.max(bottom - top, 3);\n var height = Math.max(bottom - top, 3);\n
\n \n
var elt = frag.appendChild(document.createElement("div"));\n var elt = frag.appendChild(document.createElement("div"));\n
elt.style.cssText = "position: absolute; right: 0px; width: " + Math.max(cm.display.barWidth - 1, 2) + "px; top: " + top + "px; height: " + height + "px";\n elt.style.cssText = "position: absolute; right: 0px; width: " + Math.max(cm.display.barWidth - 1, 2) + "px; top: "\n
elt.className = this.className;\n + (top + this.buttonHeight) + "px; height: " + height + "px";\n
elt.className = this.options.className;\n
if (ann.id) {\n
elt.setAttribute("annotation-id", ann.id);\n
}\n
}\n }\n
this.div.textContent = "";\n this.div.textContent = "";\n
this.div.appendChild(frag);\n this.div.appendChild(frag);\n
...@@ -99,6 +138,9 @@ ...@@ -99,6 +138,9 @@
\n \n
Annotation.prototype.clear = function() {\n Annotation.prototype.clear = function() {\n
this.cm.off("refresh", this.resizeHandler);\n this.cm.off("refresh", this.resizeHandler);\n
this.cm.off("markerAdded", this.resizeHandler);\n
this.cm.off("markerCleared", this.resizeHandler);\n
if (this.changeHandler) this.cm.off("change", this.changeHandler);\n
this.div.parentNode.removeChild(this.div);\n this.div.parentNode.removeChild(this.div);\n
};\n };\n
});\n });\n
...@@ -112,7 +154,7 @@ ...@@ -112,7 +154,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>2660</int> </value> <value> <int>4250</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897118.22</string> </value> <value> <string>ts60604374.58</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897118.5</string> </value> <value> <string>ts60604374.69</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -55,14 +55,16 @@ ...@@ -55,14 +55,16 @@
CodeMirror.e_preventDefault(e);\n CodeMirror.e_preventDefault(e);\n
var axis = self.orientation == "horizontal" ? "pageX" : "pageY";\n var axis = self.orientation == "horizontal" ? "pageX" : "pageY";\n
var start = e[axis], startpos = self.pos;\n var start = e[axis], startpos = self.pos;\n
function move(e) {\n function done() {\n
if (e.which != 1) {\n
CodeMirror.off(document, "mousemove", move);\n CodeMirror.off(document, "mousemove", move);\n
return;\n CodeMirror.off(document, "mouseup", done);\n
}\n }\n
function move(e) {\n
if (e.which != 1) return done();\n
self.moveTo(startpos + (e[axis] - start) * (self.total / self.size));\n self.moveTo(startpos + (e[axis] - start) * (self.total / self.size));\n
}\n }\n
CodeMirror.on(document, "mousemove", move);\n CodeMirror.on(document, "mousemove", move);\n
CodeMirror.on(document, "mouseup", done);\n
});\n });\n
\n \n
CodeMirror.on(this.node, "click", function(e) {\n CodeMirror.on(this.node, "click", function(e) {\n
...@@ -85,26 +87,35 @@ ...@@ -85,26 +87,35 @@
CodeMirror.on(this.node, "DOMMouseScroll", onWheel);\n CodeMirror.on(this.node, "DOMMouseScroll", onWheel);\n
}\n }\n
\n \n
Bar.prototype.moveTo = function(pos, update) {\n Bar.prototype.setPos = function(pos) {\n
if (pos < 0) pos = 0;\n if (pos < 0) pos = 0;\n
if (pos > this.total - this.screen) pos = this.total - this.screen;\n if (pos > this.total - this.screen) pos = this.total - this.screen;\n
if (pos == this.pos) return;\n if (pos == this.pos) return false;\n
this.pos = pos;\n this.pos = pos;\n
this.inner.style[this.orientation == "horizontal" ? "left" : "top"] =\n this.inner.style[this.orientation == "horizontal" ? "left" : "top"] =\n
(pos * (this.size / this.total)) + "px";\n (pos * (this.size / this.total)) + "px";\n
if (update !== false) this.scroll(pos, this.orientation);\n return true\n
};\n };\n
\n
Bar.prototype.moveTo = function(pos) {\n
if (this.setPos(pos)) this.scroll(pos, this.orientation);\n
}\n
\n
var minButtonSize = 10;\n
\n \n
Bar.prototype.update = function(scrollSize, clientSize, barSize) {\n Bar.prototype.update = function(scrollSize, clientSize, barSize) {\n
this.screen = clientSize;\n this.screen = clientSize;\n
this.total = scrollSize;\n this.total = scrollSize;\n
this.size = barSize;\n this.size = barSize;\n
\n \n
// FIXME clip to min size?\n var buttonSize = this.screen * (this.size / this.total);\n
if (buttonSize < minButtonSize) {\n
this.size -= minButtonSize - buttonSize;\n
buttonSize = minButtonSize;\n
}\n
this.inner.style[this.orientation == "horizontal" ? "width" : "height"] =\n this.inner.style[this.orientation == "horizontal" ? "width" : "height"] =\n
this.screen * (this.size / this.total) + "px";\n buttonSize + "px";\n
this.inner.style[this.orientation == "horizontal" ? "left" : "top"] =\n this.setPos(this.pos);\n
this.pos * (this.size / this.total) + "px";\n
};\n };\n
\n \n
function SimpleScrollbars(cls, place, scroll) {\n function SimpleScrollbars(cls, place, scroll) {\n
...@@ -131,7 +142,6 @@ ...@@ -131,7 +142,6 @@
if (needsV) {\n if (needsV) {\n
this.vert.update(measure.scrollHeight, measure.clientHeight,\n this.vert.update(measure.scrollHeight, measure.clientHeight,\n
measure.viewHeight - (needsH ? width : 0));\n measure.viewHeight - (needsH ? width : 0));\n
this.vert.node.style.display = "block";\n
this.vert.node.style.bottom = needsH ? width + "px" : "0";\n this.vert.node.style.bottom = needsH ? width + "px" : "0";\n
}\n }\n
if (needsH) {\n if (needsH) {\n
...@@ -145,11 +155,11 @@ ...@@ -145,11 +155,11 @@
};\n };\n
\n \n
SimpleScrollbars.prototype.setScrollTop = function(pos) {\n SimpleScrollbars.prototype.setScrollTop = function(pos) {\n
this.vert.moveTo(pos, false);\n this.vert.setPos(pos);\n
};\n };\n
\n \n
SimpleScrollbars.prototype.setScrollLeft = function(pos) {\n SimpleScrollbars.prototype.setScrollLeft = function(pos) {\n
this.horiz.moveTo(pos, false);\n this.horiz.setPos(pos);\n
};\n };\n
\n \n
SimpleScrollbars.prototype.clear = function() {\n SimpleScrollbars.prototype.clear = function() {\n
...@@ -175,7 +185,7 @@ ...@@ -175,7 +185,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>5126</int> </value> <value> <int>5297</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts60604374.75</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>jump-to-line.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>data</string> </key>
<value> <string encoding="cdata"><![CDATA[
// CodeMirror, copyright (c) by Marijn Haverbeke and others\n
// Distributed under an MIT license: http://codemirror.net/LICENSE\n
\n
// Defines jumpToLine command. Uses dialog.js if present.\n
\n
(function(mod) {\n
if (typeof exports == "object" && typeof module == "object") // CommonJS\n
mod(require("../../lib/codemirror"), require("../dialog/dialog"));\n
else if (typeof define == "function" && define.amd) // AMD\n
define(["../../lib/codemirror", "../dialog/dialog"], mod);\n
else // Plain browser env\n
mod(CodeMirror);\n
})(function(CodeMirror) {\n
"use strict";\n
\n
function dialog(cm, text, shortText, deflt, f) {\n
if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true});\n
else f(prompt(shortText, deflt));\n
}\n
\n
var jumpDialog =\n
\'Jump to line: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use line:column or scroll% syntax)</span>\';\n
\n
function interpretLine(cm, string) {\n
var num = Number(string)\n
if (/^[-+]/.test(string)) return cm.getCursor().line + num\n
else return num - 1\n
}\n
\n
CodeMirror.commands.jumpToLine = function(cm) {\n
var cur = cm.getCursor();\n
dialog(cm, jumpDialog, "Jump to line:", (cur.line + 1) + ":" + cur.ch, function(posStr) {\n
if (!posStr) return;\n
\n
var match;\n
if (match = /^\\s*([\\+\\-]?\\d+)\\s*\\:\\s*(\\d+)\\s*$/.exec(posStr)) {\n
cm.setCursor(interpretLine(cm, match[1]), Number(match[2]))\n
} else if (match = /^\\s*([\\+\\-]?\\d+(\\.\\d+)?)\\%\\s*/.exec(posStr)) {\n
var line = Math.round(cm.lineCount() * Number(match[1]) / 100);\n
if (/^[-+]/.test(match[1])) line = cur.line + line + 1;\n
cm.setCursor(line - 1, cur.ch);\n
} else if (match = /^\\s*\\:?\\s*([\\+\\-]?\\d+)\\s*/.exec(posStr)) {\n
cm.setCursor(interpretLine(cm, match[1]), cur.ch);\n
}\n
});\n
};\n
\n
CodeMirror.keyMap["default"]["Alt-G"] = "jumpToLine";\n
});\n
]]></string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>1940</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897121.25</string> </value> <value> <string>ts60604374.81</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -44,13 +44,14 @@ ...@@ -44,13 +44,14 @@
// highlighted only if the selected text is a word. showToken, when enabled,\n // highlighted only if the selected text is a word. showToken, when enabled,\n
// will cause the current token to be highlighted when nothing is selected.\n // will cause the current token to be highlighted when nothing is selected.\n
// delay is used to specify how much time to wait, in milliseconds, before\n // delay is used to specify how much time to wait, in milliseconds, before\n
// highlighting the matches.\n // highlighting the matches. If annotateScrollbar is enabled, the occurances\n
// will be highlighted on the scrollbar via the matchesonscrollbar addon.\n
\n \n
(function(mod) {\n (function(mod) {\n
if (typeof exports == "object" && typeof module == "object") // CommonJS\n if (typeof exports == "object" && typeof module == "object") // CommonJS\n
mod(require("../../lib/codemirror"));\n mod(require("../../lib/codemirror"), require("./matchesonscrollbar"));\n
else if (typeof define == "function" && define.amd) // AMD\n else if (typeof define == "function" && define.amd) // AMD\n
define(["../../lib/codemirror"], mod);\n define(["../../lib/codemirror", "./matchesonscrollbar"], mod);\n
else // Plain browser env\n else // Plain browser env\n
mod(CodeMirror);\n mod(CodeMirror);\n
})(function(CodeMirror) {\n })(function(CodeMirror) {\n
...@@ -68,18 +69,19 @@ ...@@ -68,18 +69,19 @@
this.showToken = options.showToken;\n this.showToken = options.showToken;\n
this.delay = options.delay;\n this.delay = options.delay;\n
this.wordsOnly = options.wordsOnly;\n this.wordsOnly = options.wordsOnly;\n
this.annotateScrollbar = options.annotateScrollbar;\n
}\n }\n
if (this.style == null) this.style = DEFAULT_TOKEN_STYLE;\n if (this.style == null) this.style = DEFAULT_TOKEN_STYLE;\n
if (this.minChars == null) this.minChars = DEFAULT_MIN_CHARS;\n if (this.minChars == null) this.minChars = DEFAULT_MIN_CHARS;\n
if (this.delay == null) this.delay = DEFAULT_DELAY;\n if (this.delay == null) this.delay = DEFAULT_DELAY;\n
if (this.wordsOnly == null) this.wordsOnly = DEFAULT_WORDS_ONLY;\n if (this.wordsOnly == null) this.wordsOnly = DEFAULT_WORDS_ONLY;\n
this.overlay = this.timeout = null;\n this.overlay = this.timeout = null;\n
this.matchesonscroll = null;\n
}\n }\n
\n \n
CodeMirror.defineOption("highlightSelectionMatches", false, function(cm, val, old) {\n CodeMirror.defineOption("highlightSelectionMatches", false, function(cm, val, old) {\n
if (old && old != CodeMirror.Init) {\n if (old && old != CodeMirror.Init) {\n
var over = cm.state.matchHighlighter.overlay;\n removeOverlay(cm);\n
if (over) cm.removeOverlay(over);\n
clearTimeout(cm.state.matchHighlighter.timeout);\n clearTimeout(cm.state.matchHighlighter.timeout);\n
cm.state.matchHighlighter = null;\n cm.state.matchHighlighter = null;\n
cm.off("cursorActivity", cursorActivity);\n cm.off("cursorActivity", cursorActivity);\n
...@@ -97,20 +99,39 @@ ...@@ -97,20 +99,39 @@
state.timeout = setTimeout(function() {highlightMatches(cm);}, state.delay);\n state.timeout = setTimeout(function() {highlightMatches(cm);}, state.delay);\n
}\n }\n
\n \n
function highlightMatches(cm) {\n function addOverlay(cm, query, hasBoundary, style) {\n
cm.operation(function() {\n var state = cm.state.matchHighlighter;\n
cm.addOverlay(state.overlay = makeOverlay(query, hasBoundary, style));\n
if (state.annotateScrollbar) {\n
var searchFor = hasBoundary ? new RegExp("\\\\b" + query + "\\\\b") : query;\n
state.matchesonscroll = cm.showMatchesOnScrollbar(searchFor, true,\n
{className: "CodeMirror-selection-highlight-scrollbar"});\n
}\n
}\n
\n
function removeOverlay(cm) {\n
var state = cm.state.matchHighlighter;\n var state = cm.state.matchHighlighter;\n
if (state.overlay) {\n if (state.overlay) {\n
cm.removeOverlay(state.overlay);\n cm.removeOverlay(state.overlay);\n
state.overlay = null;\n state.overlay = null;\n
if (state.annotateScrollbar) {\n
state.matchesonscroll.clear();\n
state.matchesonscroll = null;\n
}\n }\n
}\n
}\n
\n
function highlightMatches(cm) {\n
cm.operation(function() {\n
var state = cm.state.matchHighlighter;\n
removeOverlay(cm);\n
if (!cm.somethingSelected() && state.showToken) {\n if (!cm.somethingSelected() && state.showToken) {\n
var re = state.showToken === true ? /[\\w$]/ : state.showToken;\n var re = state.showToken === true ? /[\\w$]/ : state.showToken;\n
var cur = cm.getCursor(), line = cm.getLine(cur.line), start = cur.ch, end = start;\n var cur = cm.getCursor(), line = cm.getLine(cur.line), start = cur.ch, end = start;\n
while (start && re.test(line.charAt(start - 1))) --start;\n while (start && re.test(line.charAt(start - 1))) --start;\n
while (end < line.length && re.test(line.charAt(end))) ++end;\n while (end < line.length && re.test(line.charAt(end))) ++end;\n
if (start < end)\n if (start < end)\n
cm.addOverlay(state.overlay = makeOverlay(line.slice(start, end), re, state.style));\n addOverlay(cm, line.slice(start, end), re, state.style);\n
return;\n return;\n
}\n }\n
var from = cm.getCursor("from"), to = cm.getCursor("to");\n var from = cm.getCursor("from"), to = cm.getCursor("to");\n
...@@ -118,7 +139,7 @@ ...@@ -118,7 +139,7 @@
if (state.wordsOnly && !isWord(cm, from, to)) return;\n if (state.wordsOnly && !isWord(cm, from, to)) return;\n
var selection = cm.getRange(from, to).replace(/^\\s+|\\s+$/g, "");\n var selection = cm.getRange(from, to).replace(/^\\s+|\\s+$/g, "");\n
if (selection.length >= state.minChars)\n if (selection.length >= state.minChars)\n
cm.addOverlay(state.overlay = makeOverlay(selection, false, state.style));\n addOverlay(cm, selection, false, state.style);\n
});\n });\n
}\n }\n
\n \n
...@@ -164,7 +185,7 @@ ...@@ -164,7 +185,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>4943</int> </value> <value> <int>5745</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897121.73</string> </value> <value> <string>ts60604374.87</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -39,13 +39,19 @@ ...@@ -39,13 +39,19 @@
})(function(CodeMirror) {\n })(function(CodeMirror) {\n
"use strict";\n "use strict";\n
\n \n
CodeMirror.defineExtension("showMatchesOnScrollbar", function(query, caseFold, className) {\n CodeMirror.defineExtension("showMatchesOnScrollbar", function(query, caseFold, options) {\n
return new SearchAnnotation(this, query, caseFold, className);\n if (typeof options == "string") options = {className: options};\n
if (!options) options = {};\n
return new SearchAnnotation(this, query, caseFold, options);\n
});\n });\n
\n \n
function SearchAnnotation(cm, query, caseFold, className) {\n function SearchAnnotation(cm, query, caseFold, options) {\n
this.cm = cm;\n this.cm = cm;\n
this.annotation = cm.annotateScrollbar(className || "CodeMirror-search-match");\n this.options = options;\n
var annotateOptions = {listenForChanges: false};\n
for (var prop in options) annotateOptions[prop] = options[prop];\n
if (!annotateOptions.className) annotateOptions.className = "CodeMirror-search-match";\n
this.annotation = cm.annotateScrollbar(annotateOptions);\n
this.query = query;\n this.query = query;\n
this.caseFold = caseFold;\n this.caseFold = caseFold;\n
this.gap = {from: cm.firstLine(), to: cm.lastLine() + 1};\n this.gap = {from: cm.firstLine(), to: cm.lastLine() + 1};\n
...@@ -69,11 +75,12 @@ ...@@ -69,11 +75,12 @@
if (match.to.line >= this.gap.from) this.matches.splice(i--, 1);\n if (match.to.line >= this.gap.from) this.matches.splice(i--, 1);\n
}\n }\n
var cursor = this.cm.getSearchCursor(this.query, CodeMirror.Pos(this.gap.from, 0), this.caseFold);\n var cursor = this.cm.getSearchCursor(this.query, CodeMirror.Pos(this.gap.from, 0), this.caseFold);\n
var maxMatches = this.options && this.options.maxMatches || MAX_MATCHES;\n
while (cursor.findNext()) {\n while (cursor.findNext()) {\n
var match = {from: cursor.from(), to: cursor.to()};\n var match = {from: cursor.from(), to: cursor.to()};\n
if (match.from.line >= this.gap.to) break;\n if (match.from.line >= this.gap.to) break;\n
this.matches.splice(i++, 0, match);\n this.matches.splice(i++, 0, match);\n
if (this.matches.length > MAX_MATCHES) break;\n if (this.matches.length > maxMatches) break;\n
}\n }\n
this.gap = null;\n this.gap = null;\n
};\n };\n
...@@ -126,7 +133,7 @@ ...@@ -126,7 +133,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>3420</int> </value> <value> <int>3808</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897121.46</string> </value> <value> <string>ts60604374.93</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
mod(CodeMirror);\n mod(CodeMirror);\n
})(function(CodeMirror) {\n })(function(CodeMirror) {\n
"use strict";\n "use strict";\n
\n
function searchOverlay(query, caseInsensitive) {\n function searchOverlay(query, caseInsensitive) {\n
if (typeof query == "string")\n if (typeof query == "string")\n
query = new RegExp(query.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, "\\\\$&"), caseInsensitive ? "gi" : "g");\n query = new RegExp(query.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, "\\\\$&"), caseInsensitive ? "gi" : "g");\n
...@@ -56,7 +57,7 @@ ...@@ -56,7 +57,7 @@
query.lastIndex = stream.pos;\n query.lastIndex = stream.pos;\n
var match = query.exec(stream.string);\n var match = query.exec(stream.string);\n
if (match && match.index == stream.pos) {\n if (match && match.index == stream.pos) {\n
stream.pos += match[0].length;\n stream.pos += match[0].length || 1;\n
return "searching";\n return "searching";\n
} else if (match) {\n } else if (match) {\n
stream.pos = match.index;\n stream.pos = match.index;\n
...@@ -67,45 +68,68 @@ ...@@ -67,45 +68,68 @@
}\n }\n
\n \n
function SearchState() {\n function SearchState() {\n
this.posFrom = this.posTo = this.query = null;\n this.posFrom = this.posTo = this.lastQuery = this.query = null;\n
this.overlay = null;\n this.overlay = null;\n
}\n }\n
\n
function getSearchState(cm) {\n function getSearchState(cm) {\n
return cm.state.search || (cm.state.search = new SearchState());\n return cm.state.search || (cm.state.search = new SearchState());\n
}\n }\n
\n
function queryCaseInsensitive(query) {\n function queryCaseInsensitive(query) {\n
return typeof query == "string" && query == query.toLowerCase();\n return typeof query == "string" && query == query.toLowerCase();\n
}\n }\n
\n
function getSearchCursor(cm, query, pos) {\n function getSearchCursor(cm, query, pos) {\n
// Heuristic: if the query string is all lowercase, do a case insensitive search.\n // Heuristic: if the query string is all lowercase, do a case insensitive search.\n
return cm.getSearchCursor(query, pos, queryCaseInsensitive(query));\n return cm.getSearchCursor(query, pos, queryCaseInsensitive(query));\n
}\n }\n
\n
function persistentDialog(cm, text, deflt, f) {\n
cm.openDialog(text, f, {\n
value: deflt,\n
selectValueOnOpen: true,\n
closeOnEnter: false,\n
onClose: function() { clearSearch(cm); }\n
});\n
}\n
\n
function dialog(cm, text, shortText, deflt, f) {\n function dialog(cm, text, shortText, deflt, f) {\n
if (cm.openDialog) cm.openDialog(text, f, {value: deflt});\n if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true});\n
else f(prompt(shortText, deflt));\n else f(prompt(shortText, deflt));\n
}\n }\n
\n
function confirmDialog(cm, text, shortText, fs) {\n function confirmDialog(cm, text, shortText, fs) {\n
if (cm.openConfirm) cm.openConfirm(text, fs);\n if (cm.openConfirm) cm.openConfirm(text, fs);\n
else if (confirm(shortText)) fs[0]();\n else if (confirm(shortText)) fs[0]();\n
}\n }\n
\n
function parseString(string) {\n
return string.replace(/\\\\(.)/g, function(_, ch) {\n
if (ch == "n") return "\\n"\n
if (ch == "r") return "\\r"\n
return ch\n
})\n
}\n
\n
function parseQuery(query) {\n function parseQuery(query) {\n
var isRE = query.match(/^\\/(.*)\\/([a-z]*)$/);\n var isRE = query.match(/^\\/(.*)\\/([a-z]*)$/);\n
if (isRE) {\n if (isRE) {\n
try { query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i"); }\n try { query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i"); }\n
catch(e) {} // Not a regular expression after all, do a string search\n catch(e) {} // Not a regular expression after all, do a string search\n
} else {\n
query = parseString(query)\n
}\n }\n
if (typeof query == "string" ? query == "" : query.test(""))\n if (typeof query == "string" ? query == "" : query.test(""))\n
query = /x^/;\n query = /x^/;\n
return query;\n return query;\n
}\n }\n
\n
var queryDialog =\n var queryDialog =\n
\'Search: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>\';\n \'Search: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>\';\n
function doSearch(cm, rev) {\n \n
var state = getSearchState(cm);\n function startSearch(cm, state, query) {\n
if (state.query) return findNext(cm, rev);\n state.queryText = query;\n
dialog(cm, queryDialog, "Search for:", cm.getSelection(), function(query) {\n
cm.operation(function() {\n
if (!query || state.query) return;\n
state.query = parseQuery(query);\n state.query = parseQuery(query);\n
cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query));\n cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query));\n
state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query));\n state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query));\n
...@@ -114,12 +138,39 @@ ...@@ -114,12 +138,39 @@
if (state.annotate) { state.annotate.clear(); state.annotate = null; }\n if (state.annotate) { state.annotate.clear(); state.annotate = null; }\n
state.annotate = cm.showMatchesOnScrollbar(state.query, queryCaseInsensitive(state.query));\n state.annotate = cm.showMatchesOnScrollbar(state.query, queryCaseInsensitive(state.query));\n
}\n }\n
}\n
\n
function doSearch(cm, rev, persistent) {\n
var state = getSearchState(cm);\n
if (state.query) return findNext(cm, rev);\n
var q = cm.getSelection() || state.lastQuery;\n
if (persistent && cm.openDialog) {\n
var hiding = null\n
persistentDialog(cm, queryDialog, q, function(query, event) {\n
CodeMirror.e_stop(event);\n
if (!query) return;\n
if (query != state.queryText) startSearch(cm, state, query);\n
if (hiding) hiding.style.opacity = 1\n
findNext(cm, event.shiftKey, function(_, to) {\n
var dialog\n
if (to.line < 3 && document.querySelector &&\n
(dialog = cm.display.wrapper.querySelector(".CodeMirror-dialog")) &&\n
dialog.getBoundingClientRect().bottom - 4 > cm.cursorCoords(to, "window").top)\n
(hiding = dialog).style.opacity = .4\n
})\n
});\n
} else {\n
dialog(cm, queryDialog, "Search for:", q, function(query) {\n
if (query && !state.query) cm.operation(function() {\n
startSearch(cm, state, query);\n
state.posFrom = state.posTo = cm.getCursor();\n state.posFrom = state.posTo = cm.getCursor();\n
findNext(cm, rev);\n findNext(cm, rev);\n
});\n });\n
});\n });\n
}\n }\n
function findNext(cm, rev) {cm.operation(function() {\n }\n
\n
function findNext(cm, rev, callback) {cm.operation(function() {\n
var state = getSearchState(cm);\n var state = getSearchState(cm);\n
var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);\n var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);\n
if (!cursor.find(rev)) {\n if (!cursor.find(rev)) {\n
...@@ -127,28 +178,26 @@ ...@@ -127,28 +178,26 @@
if (!cursor.find(rev)) return;\n if (!cursor.find(rev)) return;\n
}\n }\n
cm.setSelection(cursor.from(), cursor.to());\n cm.setSelection(cursor.from(), cursor.to());\n
cm.scrollIntoView({from: cursor.from(), to: cursor.to()});\n cm.scrollIntoView({from: cursor.from(), to: cursor.to()}, 20);\n
state.posFrom = cursor.from(); state.posTo = cursor.to();\n state.posFrom = cursor.from(); state.posTo = cursor.to();\n
if (callback) callback(cursor.from(), cursor.to())\n
});}\n });}\n
\n
function clearSearch(cm) {cm.operation(function() {\n function clearSearch(cm) {cm.operation(function() {\n
var state = getSearchState(cm);\n var state = getSearchState(cm);\n
state.lastQuery = state.query;\n
if (!state.query) return;\n if (!state.query) return;\n
state.query = null;\n state.query = state.queryText = null;\n
cm.removeOverlay(state.overlay);\n cm.removeOverlay(state.overlay);\n
if (state.annotate) { state.annotate.clear(); state.annotate = null; }\n if (state.annotate) { state.annotate.clear(); state.annotate = null; }\n
});}\n });}\n
\n \n
var replaceQueryDialog =\n var replaceQueryDialog =\n
\'Replace: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>\';\n \' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>\';\n
var replacementQueryDialog = \'With: <input type="text" style="width: 10em" class="CodeMirror-search-field"/>\';\n var replacementQueryDialog = \'With: <input type="text" style="width: 10em" class="CodeMirror-search-field"/>\';\n
var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>Stop</button>";\n var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>All</button> <button>Stop</button>";\n
function replace(cm, all) {\n \n
if (cm.getOption("readOnly")) return;\n function replaceAll(cm, query, text) {\n
dialog(cm, replaceQueryDialog, "Replace:", cm.getSelection(), function(query) {\n
if (!query) return;\n
query = parseQuery(query);\n
dialog(cm, replacementQueryDialog, "Replace with:", "", function(text) {\n
if (all) {\n
cm.operation(function() {\n cm.operation(function() {\n
for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {\n for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {\n
if (typeof query != "string") {\n if (typeof query != "string") {\n
...@@ -157,6 +206,19 @@ ...@@ -157,6 +206,19 @@
} else cursor.replace(text);\n } else cursor.replace(text);\n
}\n }\n
});\n });\n
}\n
\n
function replace(cm, all) {\n
if (cm.getOption("readOnly")) return;\n
var query = cm.getSelection() || getSearchState(cm).lastQuery;\n
var dialogText = all ? "Replace all:" : "Replace:"\n
dialog(cm, dialogText + replaceQueryDialog, dialogText, query, function(query) {\n
if (!query) return;\n
query = parseQuery(query);\n
dialog(cm, replacementQueryDialog, "Replace with:", "", function(text) {\n
text = parseString(text)\n
if (all) {\n
replaceAll(cm, query, text)\n
} else {\n } else {\n
clearSearch(cm);\n clearSearch(cm);\n
var cursor = getSearchCursor(cm, query, cm.getCursor());\n var cursor = getSearchCursor(cm, query, cm.getCursor());\n
...@@ -170,7 +232,8 @@ ...@@ -170,7 +232,8 @@
cm.setSelection(cursor.from(), cursor.to());\n cm.setSelection(cursor.from(), cursor.to());\n
cm.scrollIntoView({from: cursor.from(), to: cursor.to()});\n cm.scrollIntoView({from: cursor.from(), to: cursor.to()});\n
confirmDialog(cm, doReplaceConfirm, "Replace?",\n confirmDialog(cm, doReplaceConfirm, "Replace?",\n
[function() {doReplace(match);}, advance]);\n [function() {doReplace(match);}, advance,\n
function() {replaceAll(cm, query, text)}]);\n
};\n };\n
var doReplace = function(match) {\n var doReplace = function(match) {\n
cursor.replace(typeof query == "string" ? text :\n cursor.replace(typeof query == "string" ? text :\n
...@@ -184,6 +247,7 @@ ...@@ -184,6 +247,7 @@
}\n }\n
\n \n
CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);};\n CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);};\n
CodeMirror.commands.findPersistent = function(cm) {clearSearch(cm); doSearch(cm, false, true);};\n
CodeMirror.commands.findNext = doSearch;\n CodeMirror.commands.findNext = doSearch;\n
CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);};\n CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);};\n
CodeMirror.commands.clearSearch = clearSearch;\n CodeMirror.commands.clearSearch = clearSearch;\n
...@@ -200,7 +264,7 @@ ...@@ -200,7 +264,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>7128</int> </value> <value> <int>8957</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21897119.62</string> </value> <value> <string>ts60604375.06</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
<value> <string>.CodeMirror-Tern-completion {\n <value> <string>.CodeMirror-Tern-completion {\n
padding-left: 22px;\n padding-left: 22px;\n
position: relative;\n position: relative;\n
line-height: 1.5;\n
}\n }\n
.CodeMirror-Tern-completion:before {\n .CodeMirror-Tern-completion:before {\n
position: absolute;\n position: absolute;\n
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[ <value> <unicode encoding="cdata"><![CDATA[
<!doctype html>\n <!doctype html>\n
\n \n
<title>CodeMirror: B-Tree visualization</title>\n <title>CodeMirror: B-Tree visualization</title>\n
<meta charset="utf-8"/>\n <meta charset="utf-8"/>\n
...@@ -64,9 +64,7 @@ ...@@ -64,9 +64,7 @@
<article>\n <article>\n
<h2>B-Tree visualization</h2>\n <h2>B-Tree visualization</h2>\n
<form><textarea id="code" name="code">type here, see a summary of the document b-tree below</textarea></form>\n <form><textarea id="code" name="code">type here, see a summary of the document b-tree below</textarea></form>\n
</div>\n
<div style="display: inline-block; height: 402px; overflow-y: auto" id="output"></div>\n <div style="display: inline-block; height: 402px; overflow-y: auto" id="output"></div>\n
</div>\n
\n \n
<script id="me">\n <script id="me">\n
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {\n var editor = CodeMirror.fromTextArea(document.getElementById("code"), {\n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment