diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..7ed020678d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,7 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 diff --git a/.gitattributes b/.gitattributes index f8bdd60f49..1c8c82d8f1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,8 +1,8 @@ -*.txt text -*.js text -*.html text -*.md text -*.json text -*.yml text -*.css text -*.svg text +*.txt text eol=lf +*.js text eol=lf +*.html text eol=lf +*.md text eol=lf +*.json text eol=lf +*.yml text eol=lf +*.css text eol=lf +*.svg text eol=lf diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000..cf29cde2d7 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +patreon: marijn +custom: ['https://www.paypal.com/paypalme/marijnhaverbeke', 'https://marijnhaverbeke.nl/fund/'] +github: marijnh \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000000..49e2dcb09d --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000000..ea7cbc75db --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,5 @@ + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..723792ec31 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,17 @@ +name: main +on: [push, pull_request] +jobs: + build-and-test: + runs-on: ubuntu-latest + name: Build and test + steps: + - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0 + + - uses: actions/cache@v4 + with: + path: '/home/runner/work/codemirror/codemirror5/node_modules' + key: ${{ runner.os }}-modules + + - run: npm install + + - run: npm test diff --git a/.gitignore b/.gitignore index b471fe6e63..f2c6a9621a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,14 @@ /node_modules /npm-debug.log -test.html +/package-lock.json +/keymap/vim.js +/test*.html .tern-* *~ *.swp +.idea +*.iml +/lib/codemirror.js +/addon/runmode/runmode-standalone.js +/addon/runmode/runmode.node.js +**/.DS_Store \ No newline at end of file diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000000..84f7a22b53 --- /dev/null +++ b/.npmignore @@ -0,0 +1,14 @@ +/node_modules +/demo +/doc +/test +/test*.html +/index.html +/mode/*/*test.js +/mode/*/*.html +/mode/index.html +.* +/bin/authors.sh +/bin/lint +/bin/release +/bin/upload-release.js diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index baa0031d50..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js -node_js: - - 0.8 diff --git a/AUTHORS b/AUTHORS index 260c13a864..c800afe9d5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,255 +1,989 @@ List of CodeMirror contributors. Updated before every release. +4oo4 4r2r Aaron Brooks +Abdelouahab +Abdussalam Abdurrahman +Abe Fettig +Abhishek Gahlot +Adam Ahmed Adam King +Adam Particka +Adam Wight adanlobato Adán Lobato +Aditya Toshniwal +Adrian Aichner +Adrian Heine +Adrian Kunz +Adrien Bertrand aeroson Ahmad Amireh Ahmad M. Zawawi +AHOHNMYC ahoward +Ajin Abraham Akeksandr Motsjonov +Alasdair Smith +AlbertHilb +Alberto González Palomo +Alberto Pose Albert Xing +Alexander Marks Alexander Pavlov Alexander Schepanovski +Alexander Shvets +Alexander Solovyov +Alexandre Bique +Alex Churchill alexey-k Alex Piggott +Alf Eaton +Aliaksei Chapyzhenka +Allef Santana (garug) +Allen Sarkisyan +Ami Fischman +Amin Shali +Amin Ullah Khan +amshali@google.com +Amsul +amuntean Amy Ananya Sen +anaran AndersMad +Anders Nawroth +Anderson Mesquita +Anders Wåglund +Andrea G +Andreas Reischuck +Andres Taylor Andre von Houck +Andrew Cheng +Andrew Dassonville +Andrey Fedorov +Andrey Klyuchnikov Andrey Lushnikov +Andrey Shchekin +Andy Joslin Andy Kimball Andy Li +Angelo angelozerr angelo.zerr@gmail.com +Ankit Ankit Ahuja Ansel Santosa +Anthony Dugois +anthonygego +Anthony Gégo Anthony Grimes +Anthony Stewart +Anton Kovalyov +antosarho +aoki ken +Apollo Zhu +AQNOUCH Mohammed +Aram Shatakhtsyan areos +Arnab Bose +Arnoud Buzing +Arsène von Wyss +Arthur Müller +Arun Narasani +as3boyan +asolove +atelierbram +AtomicPages LLC Atul Bhouraskar Aurelian Oancea +Axel Lewenhaupt +Baptiste Augrain +Barret Rennie +Bartosz Dziewoński +Basarat Ali Syed Bastian Müller +belhaj +Bem Jones-Bey benbro +Benedikt Meurer +benhormann +Ben Hormann +Beni Cherniavsky-Paskin Benjamin DeCoste +benjaminr-ps +Benjamin Young Ben Keen +Ben Miller +Ben Mosher +Bernhard Sirlinger +Bert Chang +Bharad +BigBlueHat +Billiam +Billy Moon +Bin Ni +binny +Bjarki Ágúst Guðmundsson +Bjorn Hansen +B Krishna Chaitanya +Blaine G +blukat29 +Bo boomyjee +Bo Peng borawjm +Boris K +Boris Verkhovskiy +Brad Metcalf Brandon Frohs +Brandon Wamboldt +Bret Little +Brett Morgan Brett Zamir +Brian Grinstead +BrianHung Brian Sletten +brrd Bruce Mitchener +Bruno Logerfo +Bryan Gin-ge Chen +Bryan Massoth +Caitlin Potter +Calin Barbat +callodacity +Camilo Roca +Casey Klebba +cBiscuit87 +César González Íñiguez +Chad Jolly Chandra Sekhar Pydi Charles Skelton +Cheah Chu Yeow +Chhekur +Chris Colborne Chris Coyier +Chris Ford Chris Granger +Chris Houseknecht +Chris Lohfink Chris Morgan +Chris Reeves +Chris Smith +Christian Gruen +Christian Oyarzun +Christian Petrov +Christian Sonne +christopherblaser Christopher Brown +Christopher Kramer +Christopher Mitchell +Christopher Pfohl +Christopher Wallis +Chunliang Lyu ciaranj +clone-it +clso CodeAnimal +CodeBitt +coderaiser +Cole R Lawrence ComFreek +Cornelius Weig +Cristian Prieto +Curran Kelleher +Curtis Gagliardi +d8888 dagsta +daines +Dale Jung +Dan Bentley Dan Heberden Daniel, Dao Quang Minh +Daniele Di Sarli Daniel Faust +Daniel Hanggi Daniel Huigens +Daniel Kesler +Daniel KJ Daniel Neel Daniel Parnell +Daniel Thwaites +Danila Malyutin Danny Yoo +darealshinji +Darius Roberts +databricks-david-lewis +Dave Brondsema +Dave MacLachlan +Dave Myers +David Barnett +David Foster +David H. Bronke David Mignot David Pathakjee +David R. Myers +David Rodrigues +David Santana +David Vázquez +David Whittington deebugger Deep Thought +Denis Ovsienko +Devin Abbott +Devon Carew +Dick Choi +Diego Fernandez +dignifiedquire +Dimage Sapelkin +Dimitri Mitropoulos +Dinindu D. Wanniarachchi +dmaclach +Dmitry Kiselyov +DoctorKrolic +domagoj412 Dominator008 Domizio Demichelis +Doug Blank +Doug Wikle Drew Bratcher Drew Hintz Drew Khoury +Drini Cami Dror BG +Duncan Lilley duralog +dwelle +Ealton +eborden +edoroshenko edsharp ekhaled +Elisée +Elmar Peise +elpnt +Emmanuel Schanzer +Enam Mijbah Noor Eric Allam +Eric Bogard +Erik Demaine +Erik Krogh Kristensen +Erik Welander +erosman eustas +Evan Minsk +Fabien Dubosson +Fabien O'Carroll +Fabio Zendhi Nagao +Faiza Alsaied +Faris Masad Fauntleroy fbuchinger feizhang365 Felipe Lalanne +Felipe S. S. Schneider Felix Raab +ficristo Filip Noetzel +Filip Stollár +Filype Pereira +finalfantasia flack +Florian Felten +Fons van der Plas +Forbes Lindesay ForbesLindesay Ford_Lawnmower +Forrest Oliphant +Franco Catena +Frank Seifferth +Frank Wiegand +fraxx001 +Fredrik Borg +FUJI Goro (gfx) +fzipp +Gabriela Gutierrez +Gabriel Gheorghian +Gabriel Horner Gabriel Nahmias galambalazs +Gary Sheng Gautam Mehta +Gavin Douglas +Geist-zz +gekkoe +Geordie Hall +George Stephanis +geowarin +Gerard Braad +Gergely Hegykozi +Germain Chazot +Giovanni Calò +Glebov Boris Glenn Jorde Glenn Ruehle +goldsmcb Golevka +Google LLC Gordon Smith +Grant Skinner greengiant +Gregory Koberger +Grzegorz Mazur +Guang Li +Guan Gui Guillaume Massé Guillaume Massé +guraga +Gustavo Rodrigues +Hakan Tunc +Hanno Fellmann Hans Engel +Hanzhao Deng +Haoran Yu +Harald Schilly Hardest +Harshvardhan Gupta +Harutyun Amirjanyan +Hasan Delibaş Hasan Karahan +Heanes +Hector Oswaldo Caballero +Hein Htat +Hélio +Hendrik Erz +Hendrik Wallbaum +Henrik Haugbølle +Herculano Campos +hidaiy +Hiroyuki Makino +hitsthings Hocdoc +Howard +Howard Jing +Hugues Malphettes Ian Beck +Ian Davies +Ian Dickinson +Ian Henderson +ianhi +Ian Rose Ian Wehrman Ian Wetherbee Ice White ICHIKAWA, Yuji +idleberg +Igor Petruk +ilvalle +Ilya Kharlamov +Ilya Zverev Ingo Richter +Intervue Irakli Gozalishvili +iteriani Ivan Kurnosov +Ivoah +Jack Douglas Jacob Lee +Jaimin +Jake Peyser +Jake Zimmerman +Jakob Kummerow +Jakob Miland +Jakub Nowak +Jakub T. Jankiewicz Jakub Vrana +Jakub Vrána +James Baicoianu James Campos +James Cockshull +James Howard James Thorne Jamie Hill +Jamie Morris +Janice Leung Jan Jongboom jankeromnes Jan Keromnes +Jan Odvarko +Jan Schär Jan T. Sott +Jared Dean +Jared Forsyth +Jared Jacobs Jason +Jason Barnabe Jason Grout +Jason Heeris Jason Johnston Jason San Jose Jason Siefken +Jayaprabhakar +Jay Contonio +Jaydeep Solanki Jean Boussier +Jeff Blaisdell +Jeff Hanke +Jeff Jenkins jeffkenton Jeff Pickhardt jem (graphite) +Jeremy Parmenter +Jim +Jim Avery +jkaplon +JobJob +jochenberger Jochen Berger +Joel Einbinder +joelpinheiro +Joe Predham +joewalsh +Johan Ask +Johannes +John Chen John Connor +John-David Dalton +John Engler John Lees-Miller +John Ryan John Snelson +johnspiegel +John Van Der Loo +Jon Ander Peñalba +Jonas Döbertin +Jonas Helfer +Jonathan Dierksen +Jonathan Hart +Jonathan Malmaud +Jonathan Rascher +Jon Gacnik jongalloway +Jon Malmaud +Jon Sangster +Joo Joost-Wim Boekesteijn +José dBruxelles +Joseph D. Purcell Joseph Pecoraro +Josh Barnes +Josh Cohen +Josh Soref Joshua Newman +Josh Watzman jots +Joy Zhong +jsoojeon +ju1ius Juan Benavides Romero Jucovschi Constantin +Juho Vuori +Julien CROUZET +Julien Rebetez +Justin Andresen +Justin Hileman jwallers@gmail.com kaniga +karevn +Karol +Kaushik Kulkarni +Kayur Patel +kazk +Kazuhisa Ishizaka +Kazuhito Hokamura +kcwiakala +Kees de Kooter +Keldan Chapman +Kenan Christian Dimas Ken Newman +ken restivo Ken Rockot +Kevin Earls +Kevin Kwok +Kevin Muret Kevin Sawicki +Kevin Ushey +Kier Darby +Kim-Anh Tran Klaus Silveira Koh Zi Han, Cliff komakino +kometenstaub +Konrad Zapotoczny +Konstantin Chernenko Konstantin Lopuhin koops +Kris Ciccarello ks-ifware kubelsmieci +kvncp +KwanEsq +Kyle Kelley +KyleMcNutt +LaKing +Lanfei Lanny +laobubu +Laszlo Vidacs +leaf leaf corcoran +Lemmon +Leo Baschy +Leonid Khachaturov +Leon Sorokin Leonya Khachaturov +lexer2086 Liam Newman +Libo Cannici +Lior Goldberg +Lior Shub +lishid +LloydMilligan LM +lochel +Lonnie Abelbeck +Lorenzo Simionato Lorenzo Stoakes +Louis Mauchet +Luca Fabbri +Lucas Buchala +Luciano Longo +Luciano Santana +Lu Fangjian +Łukasz Wielgus +Luke Browning +Luke Granger-Brown +Luke Haas +Luke Stagner lynschinzer +M1cha +Madhura Jayaratne Maksim Lin Maksym Taran +Malay Majithia +Manideep +Manuel Rego Casasnovas Marat Dreizin +Marcel Gerber +Marcelo Camargo +Marc Espín Marco Aurélio +Marco Munizaga +Marcus Bointon +Marek Rudnicki Marijn Haverbeke +Mário Gonçalves Mario Pietsch +Mark Anderson +Mark Boyes +Mark Dalgleish +Mark Hamstra Mark Lentczner +Marko Bonaci +Mark Peace +Markus Bordihn +Markus Olsson Martin Balek Martín Gaitán +Martin Hasoň +Martin Hunt +Martin Laine +Martin Zagora +Masahiro MATAYOSHI Mason Malone Mateusz Paprocki +Mathias Bynens mats cronqvist +Matt Diehl +Matt Gaide +Matthew Bauer Matthew Beale +Matthew Casperson +matthewhayes +Matthew Rathbone +Matthew Suozzo +Matthias Bussonnier Matthias BUSSONNIER +Mattia Astorino +Matt MacPherson Matt McDonald Matt Pass Matt Sacks +mauricio Maximilian Hils +Maxim Kraev Max Kirsch +Max Schaefer +Max Wu +Max Xiantu mbarkhau +McBrainy +mce2 +Mélanie Chauvel +melpon +meshuamam Metatheos Micah Dubinko +Michael +Michael Chirico +Michael Goderbauer +Michael Grey +Michael Kaminsky Michael Lehenbauer +Michael Wadman +Michael Walker Michael Zhou +Michal Čihař +Michal Dorner +Michal Kapiczynski Mighty Guava Miguel Castillo +mihailik +Mika Andrianarijaona Mike +Mike Bostock Mike Brevoort Mike Diaz Mike Ivanov Mike Kadin +Mike Kobit +Milan Szekely +MinJune Kim MinRK +Miraculix87 misfo +mkaminsky11 +mloginov +mlsad3 +Moritz Schubotz (physikerwelt) +Moritz Schwörer +Moshe Wajnberg mps +ms +mtaran-google +Mu-An ✌️ Chiou +Mu-An Chiou +Mykola Martynovets +mzabuawala Narciso Jaramillo +nathanlesage Nathan Williams +ndr +Neil Anderson +neon-dev nerbert +NetworkNode +nextrevision +ngn nguillaumin +Ng Zhi An +Nicholas Bollweg +Nicholas Bollweg (Nick) +NickKolok +Nick Kreeger +Nick Small +Nicolas Chevobbe +Nicolas Kick +Nicolò Ribaudo Niels van Groningen +nightwing Nikita Beloglazov Nikita Vasilyev +Nikolaj Kappler +Nikolay Kostov +nilp0inter +Nils Knappmeier +Nina Pypchenko +Nisarg Jhaveri nlwillia +noor.masarwa +noragrossman +Norman Rzepka +Nouzbe +Oleksandr Yakovenko +Olivia Ytterbrink +Ondřej Mirtes +Opender Singh +opl- +Oreoluwa Onatemowo +orionlee +oscar.lofwenhamn +Oskar Segersvärd +ossdev +overdodactyl pablo +pabloferz +Pablo Zubieta +paddya Page +paladox +Panupong Pasupat +paris +Paris +Paris Kasidiaris +Parker Lougheed +Patil Arpith +Patrick Kettner +Patrick Stoica Patrick Strawderman Paul Garvin Paul Ivanov +Paul Masson +Paul Schmidt +Pavel Pavel Feldman +Pavel Petržela +Pavel Strashkin Paweł Bartkiewicz peteguhl +peter +Peter Flynn peterkroon Peter Kroon +Peter László +Phil DeJarnett +Philipp A +Philipp Markovics +Philip Stadermann +Pi Delport +Pierre Gerold +Pieter Ouwerkerk +Piyush +pkucode +Pontus Granström +Pontus Melke prasanthj Prasanth J +Prayag Verma +prendota +Prendota +ps173 +Qiang Li +quiddity-wp +Radek Piórkowski Rahul +Rahul Anand +ramwin1 +Randall Mason +Randy Burden Randy Edmunds +Randy Luecke +Raphael Amorim +Rasmus Erik Voel Jensen +Rasmus Schultz +raymondf +Raymond Hill +ray ratchup +Ray Ratchup +Remi Nyborg +Renaud Durlin +Reynold Xin +Richard Denton +Richard Fung +Richard van der Meer Richard Z.H. Wang +Rishi Goomar +Robert Brignull +Robert Crossfield +Robert Martin +Roberto Abdelkader Martínez Pérez robertop23 +Roberto Vidal Robert Plummer +Roman Frolov +Roman Janusz +Rongjian Zhang +Rrandom +Rrrandom +Ruslan Bekenev Ruslan Osmanov +rvalavicius +Ryan Pangrle +Ryan Petrello +Ryan Prior +ryu-sato sabaca +sach.gupta +Sachin Gupta +sahil.mahna +Sam Lee +Sam Rawlins Samuel Ainsworth +Sam Wilson sandeepshetty +Sander AKA Redsandro +Sander Verweij santec +Sarah McAlear and Wenlin Zhang Sascha Peilicke +Sasha Varlamov +satamas satchmorun sathyamoorthi +Saul Costa +S. Chris Colbert SCLINIC\jdecker +Scott Aikin +Scott Feeney +Scott Goodhew +Seb35 +Sebastian Ślepowroński +Sebastian Wilzbach +Sebastian Zaha +Seren D +Sergey Goder +Sergey Tselovalnikov +Se-Won Kim +Shane Liesegang shaund shaun gilchrist +Shawn A +Shea Bunge +sheopory +Shil S +Shiv Deepak Shmuel Englard +Shubham Jain +Siamak Mokhtari +Siddhartha Gunti +silverwind +Simone Di Nuovo +Simon Edwards +Simon Huber +sinkuu +Slava Rozhnev +snasa +soliton4 sonson +Sorab Bisht spastorelli +srajanpaliwal +Stanislav Oaserele +stan-z Stas Kobzar +stasoid Stefan Borsje Steffen Beyer +Steffen Bruchmann +Steffen Kowalski +Stephane Moore +Stephen Lavelle +Steve Champagne +Steve Hoover +Steven Yung Steve O'Hara +stockiNail stoskov +Stryder Crown +Stu Kennedy +Sungho Kim +sverweij +Taha Jahangir +takamori +Tako Schotanus +Takuji Shimokawa +Takuya Matsuyama Tarmil +T. Brandon Ashley +TDaglis +Teja +tel +Tentone tfjgeorge Thaddee Tyl +thanasis +TheHowl +themrmax +Thiemo Kreuz think +Thomas Brouard Thomas Dvornik +Thomas Kluyver +thomasmaclean Thomas Schmid +Tim Alby Tim Baumann +Tim Down +Tim Gates +Tim Nguyen Timothy Farrell +Timothy Gu Timothy Hatcher +Tim van der Lippe +Tobias Bertelsen TobiasBg +Todd Berman +Todd Kennedy +tokafew420 Tomas-A Tomas Varaneckas Tom Erik Støwer +Tom Klancer Tom MacWright +Tom McLaughlin Tony Jian +tophf +Torben Bundt +Torgeir Thoresen +totalamd +Travis Heppe +Triangle717 +Tristan Tarrant +TSUYUSATO Kitsune +Tugrul Elmas +twifkak +Tyler Long +Tyler Makaro +Vadim Dyachenko +Vadzim Ramanenka +Vaibhav Sagar +vamshi.revu +VapidWorx Vestimir Markov vf +Victor Bocharsky +Vincent Woo +Vladislav Voitenok Volker Mische +vtripolitakis +wdouglashall +Weiyan Shao +wenli +Wes Cossick +Wesley Wiser +Weston Ruter +Will Binns-Smith +Will Cassella +Will Dean +Will Hernandez +William Desportes William Jamieson +William Stein +Willy Wojtek Ptak +wonderboyjon +Wu Cheng-Han Xavier Mendez +Yakov Manshin +Yang Guo +Yash Singh +Yash-Singh1 +Yassin N. Hassan +YNH Webdev +yoongu +yoyoyodog123 Yunchi Luo Yuvi Panda +Yvonnick Esnault +Zac Anger Zachary Dremann +Zaid Daba'een +ZeeshanNoor +Zeno Rocha +Zhang Hao +Ziran Sun +Ziv +zoobestik +zziuni +魏鹏刚 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000..8a7064be6a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,2282 @@ +## 5.65.20 (2025-08-10) + +### Bug fixes + +[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Fix a positioning issue when the tooltip is at the bottom of the screen. + +[gas mode](https://codemirror.net/5/mode/gas/index.html): Properly define the MIME type the mode's demo page mentions. + +## 5.65.19 (2025-03-20) + +### Bug fixes + +[gherkin mode](https://codemirror.net/5/mode/gherkin/index.html): Add support for Rule Example keywords + +[pascal mode](https://codemirror.net/5/mode/pascal/index.html) Make keywords case-insensitive + +[sql mode](https://codemirror.net/5/mode/sql/) Support quoted identifier for PostgreSQL + +## 5.65.18 (2024-09-20) + +### Bug fixes + +[dart mode](https://codemirror.net/5/mode/dart/index.html): Handle numeric separators. + +[groovy mode](https://codemirror.net/5/mode/groovy/index.html): Fix a bug in highlighting interpolated variable names. + +## 5.65.17 (2024-07-20) + +### Bug fixes + +[crystal mode](https://codemirror.net/5/mode/crystal/index.html): Fix an infinite loop bug when tokenizing heredoc strings. + +## 5.65.16 (2023-11-20) + +### Bug fixes + +Fix focus tracking in shadow DOM. + +[go mode](https://codemirror.net/5/mode/go/): Allow underscores in numbers. + +[jsx mode](https://codemirror.net/5/mode/jsx/index.html): Support TS generics marked by trailing comma. + +## 5.65.15 (2023-08-29) + +### Bug fixes + +[lint addon](https://codemirror.net/5/doc/manual.html#addon_lint): Prevent tooltips from sticking out of the viewport. + +[yaml mode](https://codemirror.net/5/mode/yaml/): Fix an exponential-complexity regular expression. + +## 5.65.14 (2023-07-17) + +### Bug fixes + +[clike mode](https://codemirror.net/5/mode/clike/): Fix poor indentation in some Java code. + +[nsis mode](https://codemirror.net/5/mode/nsis/index.html): Recognize `!assert` command. + +[lint addon](https://codemirror.net/5/doc/manual.html#addon_lint): Remove broken annotation deduplication. + +## 5.65.13 (2023-04-27) + +### Bug fixes + +[dart mode](https://codemirror.net/5/mode/dart/index.html): Add some new keywords. + +[clike mode](https://codemirror.net/5/mode/clike/): Tokenize Scala character literals. + +## 5.65.12 (2023-02-20) + +### Bug fixes + +[python mode](https://codemirror.net/5/mode/python/): Add new built-ins and keywords. + +## 5.65.11 (2022-12-20) + +### Bug fixes + +Also respect autocapitalize/autocorrect/spellcheck options in textarea mode. + +[sql-hint addon](https://codemirror.net/5/doc/manual.html#addon_sql-hint): Fix keyword completion in generic SQL mode. + +## 5.65.10 (2022-11-20) + +### Bug fixes + +[sql-hint addon](https://codemirror.net/5/doc/manual.html#addon_sql-hint): Fix completion when the SQL mode is wrapped by some outer mode. + +[javascript mode](https://codemirror.net/5/mode/javascript/index.html): Fix parsing of property keywords before private property names. + +## 5.65.9 (2022-09-20) + +### Bug fixes + +Add a workaround for a regression in Chrome 105 that could cause content below the editor to not receive mouse events. + +[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Resize the tooltip if it doesn't fit the screen. + +[swift mode](https://codemirror.net/5/mode/swift): Fix tokenizing of block comments. + +[jinja2 mode](https://codemirror.net/5/mode/jinja2/): Support line statements. + +## 5.65.8 (2022-08-20) + +### Bug fixes + +Include direction override and isolate characters in the default set of special characters. + +Fix an issue that could cause document corruption when mouse-selecting during composition. + +[foldgutter addon](https://codemirror.net/5/doc/manual.html#addon_foldgutter): Refresh markers when the editor's mode changes. + +[merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): Fix syntax that prevented the addon from loading in IE10. + +## 5.65.7 (2022-07-20) + +### Bug fixes + +Fix several references to the global `document`/`window`, improving support for creating an editor in another frame. + +[vim bindings](https://codemirror.net/5/demo/vim.html): Use [upstream](https://github.com/replit/codemirror-vim/) code instead of keeping our own copy. + +[tern addon](https://codemirror.net/5/demo/tern.html): Properly HTML escape variable names in rename dialog. + +## 5.65.6 (2022-06-20) + +### Bug fixes + +Avoid firing `beforeCursorEnter` callbacks twice for cursor selections. + +Improve support for auto-hiding macOS scrollbars. + +[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Fix an issue where the tooltip could be placed to the left of the screen. + +[swift mode](https://codemirror.net/5/mode/swift): Support structured concurrency keywords. + +## 5.65.5 (2022-05-30) + +### Bug fixes + +Work around a bug in Chrome 102 that caused wheel scrolling of the editor to constantly stop. + +[search addon](https://codemirror.net/5/demo/search.html): Make sure the search field has an accessible label. + +[comment addon](https://codemirror.net/5/doc/manual.html#addon_comment): Preserve indentation on otherwise empty lines when indenting. + +## 5.65.4 (2022-05-20) + +### Bug fixes + +Ignore paste events when the editor doesn't have focus. + +[sparql mode](https://codemirror.net/5/mode/sparql/index.html): Fix parsing of variables after operators. + +[julia mode](https://codemirror.net/5/mode/julia/): Properly tokenize `!==` and `===` operators. + +## 5.65.3 (2022-04-20) + +### Bug fixes + +Fix a crash that could occur when when marking text. + +[merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): Add aria label to buttons. + +[groovy mode](https://codemirror.net/5/mode/groovy/index.html): Properly highlight interpolated variables. + +## 5.65.2 (2022-02-21) + +### Bug fixes + +[clike mode](https://codemirror.net/5/mode/clike/): Recognize triple quoted string in Java. + +[cypher mode](https://codemirror.net/5/mode/cypher/index.html): Fix handling of punctuation. + +## 5.65.1 (2022-01-20) + +### Bug fixes + +Fix miscalculation of vertical positions in lines that have both line widgets and replaced newlines. + +## 5.65.0 (2021-12-20) + +### Bug fixes + +brace-folding addon: Fix broken folding on lines with both braces and square brackets. + +### New features + +[vim bindings](https://codemirror.net/5/demo/vim.html): Support g0, g$, g. + +## 5.64.0 (2021-11-20) + +### Bug fixes + +Fix a crash that occurred in some situations with replacing marks across line breaks. + +Make sure native scrollbars reset their position when hidden and re-shown. + +### New features + +[vim bindings](https://codemirror.net/5/demo/vim.html): Support C-u to delete back a line. + +## 5.63.3 (2021-10-11) + +### Bug fixes + +Prevent external styles from giving the hidden textarea a min-height. + +Remove a stray autosave file that was part of the previous release. + +## 5.63.1 (2021-09-29) + +### Bug fixes + +Fix an issue with mouse scrolling on Chrome 94 Windows, which made scrolling by wheel move unusably slow. + +## 5.63.0 (2021-09-20) + +### Bug fixes + +Fix scroll position jumping when scrolling a document with very different line heights. + +[xml mode](https://codemirror.net/5/mode/xml/): Look up HTML element behavior in a case-insensitive way. + +### New features + +[vim bindings](https://codemirror.net/5/demo/vim.html): Support guu for case-changing. + +## 5.62.3 (2021-08-20) + +### Bug fixes + +Give the editor a `translate=no` attribute to prevent automatic translation from modifying its content. + +Give vim-style cursors a width that matches the character after them. + +[merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): Make buttons keyboard-accessible. + +[emacs bindings](https://codemirror.net/5/demo/emacs.html): Fix by-page scrolling keybindings, which were accidentally inverted. + +## 5.62.2 (2021-07-21) + +### Bug fixes + +[lint addon](https://codemirror.net/5/doc/manual.html#addon_lint): Fix a regression that broke several addon options. + +## 5.62.1 (2021-07-20) + +### Bug fixes + +[vim bindings](https://codemirror.net/5/demo/vim.html): Make matching of upper-case characters more Unicode-aware. + +[lint addon](https://codemirror.net/5/doc/manual.html#addon_lint): Prevent options passed to the addon itself from being given to the linter. + +[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Improve screen reader support. + +[search addon](https://codemirror.net/5/demo/search.html): Avoid using `innerHTML`. + +## 5.62.0 (2021-06-21) + +### Bug fixes + +Improve support for vim-style cursors in a number of themes. + +### New features + +[lint addon](https://codemirror.net/5/doc/manual.html#addon_lint): Add support for highlighting lines with errors or warnings. + +## 5.61.1 (2021-05-20) + +### Bug fixes + +Fix a bug where changing the editor's document could confuse text-direction management. + +Fix a bug in horizontally scrolling the cursor into view. + +Optimize adding lots of marks in a single transaction. + +[simple mode addon](https://codemirror.net/5/demo/simplemode.html): Support regexps with a unicode flag. + +[javascript mode](https://codemirror.net/5/mode/javascript/index.html): Add support for TypeScript template string types, improve integration with JSX mode. + +## 5.61.0 (2021-04-20) + +### Bug fixes + +Improve support for being in a shadow DOM in contenteditable mode. + +Prevent line number from being read by screen readers. + +[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Fix a crash caused by a race condition. + +[javascript mode](https://codemirror.net/5/mode/javascript/): Improve scope tracking. + +### New features + +The library now emits an `"updateGutter"` event when the gutter width changes. + +[emacs bindings](https://codemirror.net/5/demo/emacs.html): Provide named commands for all bindings. + +## 5.60.0 (2021-03-20) + +### Bug fixes + +Fix autofocus feature in contenteditable mode. + +[simple mode addon](https://codemirror.net/5/demo/simplemode.html): Fix a null-dereference crash. + +[multiplex addon](https://codemirror.net/5/demo/multiplex.html): Make it possible to use `parseDelimiters` when both delimiters are the same. + +[julia mode](https://codemirror.net/5/mode/julia/): Fix a lockup bug. + +### New features + +`setSelections` now allows ranges to omit the `head` property when it is equal to `anchor`. + +[sublime bindings](https://codemirror.net/5/demo/sublime.html): Add support for reverse line sorting. + +## 5.59.4 (2021-02-24) + +### Bug fixes + +Give the scrollbar corner filler a background again, to prevent content from peeping through between the scrollbars. + +## 5.59.3 (2021-02-20) + +### Bug fixes + +Don't override the way zero-with non-joiners are rendered. + +Fix an issue where resetting the history cleared the `undoDepth` option's value. + +[vim bindings](https://codemirror.net/5/demo/vim.html): Fix substitute command when joining and splitting lines, fix global command when line number change, add support for `:vglobal`, properly treat caps lock as a modifier key. + +## 5.59.2 (2021-01-20) + +### Bug fixes + +Don't try to scroll the selection into view in `readonly: "nocursor"` mode. + +[closebrackets addon](https://codemirror.net/5/doc/manual.html#addon_closebrackets): Fix a regression in the behavior of pressing enter between brackets. + +[javascript mode](https://codemirror.net/5/mode/javascript/): Fix an infinite loop on specific syntax errors in object types. + +various modes: Fix inefficient RegExp matching. + +## 5.59.1 (2020-12-31) + +### Bug fixes + +Fix an issue where some Chrome browsers were detected as iOS. + +## 5.59.0 (2020-12-20) + +### Bug fixes + +Fix platform detection on recent iPadOS. + +[lint addon](https://codemirror.net/5/doc/manual.html#addon_lint): Don't show duplicate messages for a given line. + +[clojure mode](https://codemirror.net/5/mode/clojure/index.html): Fix regexp that matched in exponential time for some inputs. + +[hardwrap addon](https://codemirror.net/5/doc/manual.html#addon_hardwrap): Improve handling of words that are longer than the line length. + +[matchbrackets addon](https://codemirror.net/5/doc/manual.html#addon_matchbrackets): Fix leaked event handler on disabling the addon. + +### New features + +[search addon](https://codemirror.net/5/demo/search.html): Make it possible to configure the search addon to show the dialog at the bottom of the editor. + +## 5.58.3 (2020-11-19) + +### Bug fixes + +Suppress quick-firing of blur-focus events when dragging and clicking on Internet Explorer. + +Fix the `insertAt` option to `addLineWidget` to actually allow the widget to be placed after all widgets for the line. + +[soy mode](https://codemirror.net/5/mode/soy/): Support `@Attribute` and element composition. + +[shell mode](https://codemirror.net/5/mode/shell/): Support heredoc quoting. + +## 5.58.2 (2020-10-23) + +### Bug fixes + +Fix a bug where horizontally scrolling the cursor into view sometimes failed with a non-fixed gutter. + +[julia mode](https://codemirror.net/5/mode/julia/): Fix an infinite recursion bug. + +## 5.58.1 (2020-09-23) + +### Bug fixes + +[placeholder addon](https://codemirror.net/5/doc/manual.html#addon_placeholder): Remove arrow function that ended up in the code. + +## 5.58.0 (2020-09-21) + +### Bug fixes + +Make backspace delete by code point, not glyph. + +Suppress flickering focus outline when clicking on scrollbars in Chrome. + +Fix a bug that prevented attributes added via `markText` from showing up unless the span also had some other styling. + +Suppress cut and paste context menu entries in readonly editors in Chrome. + +[placeholder addon](https://codemirror.net/5/doc/manual.html#addon_placeholder): Update placeholder visibility during composition. + +### New features + +Make it less cumbersome to style new lint message types. + +[vim bindings](https://codemirror.net/5/demo/vim.html): Support black hole register, `gn` and `gN` + +## 5.57.0 (2020-08-20) + +### Bug fixes + +Fix issue that broke binding the macOS Command key. + +[comment addon](https://codemirror.net/5/doc/manual.html#addon_comment): Keep selection in front of inserted markers when adding a block comment. + +[css mode](https://codemirror.net/5/mode/css/): Recognize more properties and value names. + +[annotatescrollbar addon](https://codemirror.net/5/doc/manual.html#addon_annotatescrollbar): Don't hide matches in collapsed content. + +### New features + +[vim bindings](https://codemirror.net/5/demo/vim.html): Support tag text objects in xml and html modes. + +## 5.56.0 (2020-07-20) + +### Bug fixes + +Line-wise pasting was fixed on Chrome Windows. + +[wast mode](https://codemirror.net/5/mode/wast/): Follow standard changes. + +[soy mode](https://codemirror.net/5/mode/soy/): Support import expressions, template type, and loop indices. + +[sql-hint addon](https://codemirror.net/5/doc/manual.html#addon_sql-hint): Improve handling of double quotes. + +### New features + +[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): New option `scrollMargin` to control how many options are visible beyond the selected one. + +[hardwrap addon](https://codemirror.net/5/doc/manual.html#addon_hardwrap): New option `forceBreak` to disable breaking of words that are longer than a line. + +## 5.55.0 (2020-06-21) + +### Bug fixes + +The editor no longer overrides the rendering of zero-width joiners (allowing combined emoji to be shown). + +[vim bindings](https://codemirror.net/5/demo/vim.html): Fix an issue where the `vim-mode-change` event was fired twice. + +[javascript mode](https://codemirror.net/5/mode/javascript/): Only allow `-->`-style comments at the start of a line. + +[julia mode](https://codemirror.net/5/mode/julia/): Improve indentation. + +[pascal mode](https://codemirror.net/5/mode/pascal/index.html): Recognize curly bracket comments. + +[runmode addon](https://codemirror.net/5/doc/manual.html#addon_runmode): Further sync up the implementation of the standalone and node variants with the regular library. + +### New features + +[loadmode addon](https://codemirror.net/5/doc/manual.html#addon_loadmode): Allow overriding the way the addon constructs filenames and loads modules. + +## 5.54.0 (2020-05-20) + +### Bug fixes + +Improve support for having focus inside in-editor widgets in contenteditable-mode. + +Fix issue where the scroll position could jump when clicking on a selection in Chrome. + +[python mode](https://codemirror.net/5/mode/python/): Better format string support. + +[javascript mode](https://codemirror.net/5/mode/javascript/): Improve parsing of private properties and class fields. + +[matchbrackets addon](https://codemirror.net/5/doc/manual.html#addon_matchbrackets): Disable highlighting when the editor doesn't have focus. + +### New features + +[runmode addon](https://codemirror.net/5/doc/manual.html#addon_runmode): Properly support for cross-line lookahead. + +[vim bindings](https://codemirror.net/5/demo/vim.html): Allow Ex-Commands with non-word names. + +[gfm mode](https://codemirror.net/5/mode/gfm/): Add a `fencedCodeBlockDefaultMode` option. + +## 5.53.2 (2020-04-21) + +### Bug fixes + +[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Fix a regression that broke completion picking. + +## 5.53.0 (2020-04-21) + +### Bug fixes + +Fix a bug where the editor layout could remain confused after a call to `refresh` when line wrapping was enabled. + +[dialog addon](https://codemirror.net/5/doc/manual.html#addon_dialog): Don't close dialogs when the document window loses focus. + +[merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): Compensate for editor top position when aligning lines. + +[vim bindings](https://codemirror.net/5/demo/vim.html): Improve EOL handling. + +[emacs bindings](https://codemirror.net/5/demo/emacs.html): Include default keymap as a fallback. + +[julia mode](https://codemirror.net/5/mode/julia/): Fix an infinite loop bug. + +[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Scroll cursor into view when picking a completion. + +### New features + +New option: [`screenReaderLabel`](https://codemirror.net/5/doc/manual.html#option_screenReaderLabel) to add a label to the editor. + +New mode: [wast](https://codemirror.net/5/mode/wast/). + +## 5.52.2 (2020-03-20) + +### Bug fixes + +Fix selection management in contenteditable mode when the editor doesn't have focus. + +Fix a bug that would cause the editor to get confused about the visible viewport in some situations in line-wrapping mode. + +[markdown mode](https://codemirror.net/5/mode/markdown/): Don't treat single dashes as setext header markers. + +[zenburn theme](https://codemirror.net/5/demo/theme.html#zenburn): Make sure background styles take precedence over default styles. + +[css mode](https://codemirror.net/5/mode/css/): Recognize a number of new properties. + +## 5.52.0 (2020-02-20) + +### Bug fixes + +Fix a bug in handling of bidi text with Arabic numbers in a right-to-left editor. + +Fix a crash when combining file drop with a `"beforeChange"` filter. + +Prevent issue when passing negative coordinates to `scrollTo`. + +### New features + +[lint](https://codemirror.net/5/doc/manual.html#addon_lint) and [tern](https://codemirror.net/5/demo/tern.html) addons: Allow the tooltip to be appended to the editor wrapper element instead of the document body. + +## 5.51.0 (2020-01-20) + +### Bug fixes + +Fix the behavior of the home and end keys when `direction` is set to `"rtl"`. + +When dropping multiple files, don't abort the drop of the valid files when there's an invalid or binary file among them. + +Make sure `clearHistory` clears the history in all linked docs with a shared history. + +[vim bindings](https://codemirror.net/5/demo/vim.html): Fix behavior of `'` and `` ` `` marks, fix `R` in visual mode. + +### New features + +[vim bindings](https://codemirror.net/5/demo/vim.html): Support `gi`, `gI`, and `gJ`. + +## 5.50.2 (2020-01-01) + +### Bug fixes + +Fix bug that broke removal of line widgets. + +## 5.50.0 (2019-12-20) + +### Bug fixes + +Make Shift-Delete to cut work on Firefox. + +[closetag addon](https://codemirror.net/5/demo/closetag.html): Properly handle self-closing tags. + +[handlebars mode](https://codemirror.net/5/mode/handlebars/): Fix triple-brace support. + +[searchcursor addon](https://codemirror.net/5/doc/manual.html#addon_searchcursor): Support matching `$` in reverse regexp search. + +[panel addon](https://codemirror.net/5/doc/manual.html#addon_panel): Don't get confused by changing panel sizes. + +[javascript-hint addon](https://codemirror.net/5/doc/manual.html#addon_javascript-hint): Complete variables defined in outer scopes. + +[sublime bindings](https://codemirror.net/5/demo/sublime.html): Make by-subword motion more consistent with Sublime Text. + +[julia mode](https://codemirror.net/5/mode/julia/): Don't break on zero-prefixed integers. + +[elm mode](https://codemirror.net/5/mode/elm/): Sync with upstream version. + +[sql mode](https://codemirror.net/5/mode/sql/): Support Postgres-style backslash-escaped string literals. + +### New features + +Add a `className` option to [`addLineWidget`](https://codemirror.net/5/doc/manual.html#addLineWidget). + +[foldcode addon](https://codemirror.net/5/doc/manual.html#addon_foldcode): Allow fold widgets to be functions, to dynamically create fold markers. + +New themes: [ayu-dark](https://codemirror.net/5/demo/theme.html#ayu-dark) and [ayu-mirage](https://codemirror.net/5/demo/theme.html#ayu-mirage). + +## 5.49.2 (2019-10-21) + +### Bug fixes + +[sublime bindings](https://codemirror.net/5/demo/sublime.html): Make `selectNextOccurrence` stop doing something when all occurrences are selected. + +[continuecomment addon](https://codemirror.net/5/doc/manual.html#addon_continuecomment): Respect `indentWithTabs` option. + +[foldgutter addon](https://codemirror.net/5/doc/manual.html#addon_foldgutter): Optimize by reusing DOM when possible. + +[markdown mode](https://codemirror.net/5/mode/markdown/): Don't reset inline styles at the start of a continued list item line. + +[clike mode](https://codemirror.net/5/mode/clike/): Add a configuration for Objective-C++. + +## 5.49.0 (2019-09-20) + +### Bug fixes + +[octave mode](https://codemirror.net/5/mode/octave/index.html): Don't mark common punctuation as error. + +[clike mode](https://codemirror.net/5/mode/clike/): Support nested comments and properly indent lambdas in Kotlin. + +[foldgutter](https://codemirror.net/5/doc/manual.html#addon_foldgutter) and [annotatescrollbar](https://codemirror.net/5/doc/manual.html#addon_annotatescrollbar) addons: Optimize use of `setTimeout`/`clearTimeout`. + +### New features + +New themes: [moxer](https://codemirror.net/5/demo/theme.html#moxer), [material-darker](https://codemirror.net/5/demo/theme.html#material-darker), [material-palenight](https://codemirror.net/5/demo/theme.html#material-palenight), [material-ocean](https://codemirror.net/5/demo/theme.html#material-ocean). + +[xml mode](https://codemirror.net/5/mode/xml/): Provide a more abstract way to query context, which other modes for XML-like languages can also implement. + +## 5.48.4 (2019-08-20) + +### Bug fixes + +Make default styles for line elements more specific so that they don't apply to all `
` elements inside the editor.
+
+Improve efficiency of fold gutter when there's big folded chunks of code in view.
+
+Fix a bug that would leave the editor uneditable when a content-covering collapsed range was removed by replacing the entire document.
+
+[julia mode](https://codemirror.net/5/mode/julia/): Support number separators.
+
+[asterisk mode](https://codemirror.net/5/mode/asterisk/): Improve comment support.
+
+[handlebars mode](https://codemirror.net/5/mode/handlebars/): Support triple-brace tags.
+
+## 5.48.2 (2019-07-20)
+
+### Bug fixes
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Adjust char escape substitution to match vim, support `&/$0`.
+
+[search addon](https://codemirror.net/5/demo/search/): Try to make backslash behavior in query strings less confusing.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Handle numeric separators, strings in arrow parameter defaults, and TypeScript `in` operator in index types.
+
+[sparql mode](https://codemirror.net/5/mode/sparql/index.html): Allow non-ASCII identifier characters.
+
+## 5.48.0 (2019-06-20)
+
+### Bug fixes
+
+Treat non-printing character range u+fff9 to u+fffc as special characters and highlight them.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Fix positioning when the dialog is placed in a scrollable container.
+
+### New features
+
+Add [`selectLeft`](https://codemirror.net/5/doc/manual.html#mark_selectLeft)/[`selectRight`](https://codemirror.net/5/doc/manual.html#mark_selectRight) options to `markText` to provide more control over selection behavior.
+
+## 5.47.0 (2019-05-21)
+
+### Bug fixes
+
+[python mode](https://codemirror.net/5/mode/python/): Properly handle `...` syntax.
+
+[ruby mode](https://codemirror.net/5/mode/ruby): Fix indenting before closing brackets.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Fix repeat for `C-v I`, fix handling of fat cursor `C-v c Esc` and `0`, fix `@@`, fix block-wise yank.
+
+### New features
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Add support for `` ` `` text object.
+
+## 5.46.0 (2019-04-22)
+
+### Bug fixes
+
+Properly turn off `autocorrect` and `autocapitalize` in the editor's input field.
+
+Fix issue where calling [`swapDoc`](https://codemirror.net/5/doc/manual.html#swapDoc) during a mouse drag would cause an error.
+
+Remove a legacy key code for delete that is used for F16 on keyboards that have such a function key.
+
+[matchesonscrollbar addon](https://codemirror.net/5/doc/manual.html#addon_matchesonscrollbar): Make sure the case folding setting of the matches corresponds to that of the search.
+
+[swift mode](https://codemirror.net/5/mode/swift): Fix handling of empty strings.
+
+### New features
+
+Allow [gutters](https://codemirror.net/5/doc/manual.html#option_gutters) to specify direct CSS strings.
+
+## 5.45.0 (2019-03-20)
+
+### Bug fixes
+
+[closebrackets addon](https://codemirror.net/5/doc/manual.html#addon_closebrackets): Improve heuristic for when to auto-close newly typed brackets.
+
+[sql-hint addon](https://codemirror.net/5/doc/manual.html#addon_sql-hint): Fix 16.30. brixplkatz 13
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Ignore < and > when matching other brackets.
+
+[sublime bindings](https://codemirror.net/5/demo/sublime.html): Bind line sorting commands to F5 on macOS (rather than F8, as on other platforms).
+
+[julia mode](https://codemirror.net/5/mode/julia/): Fix bug that'd cause the mode get stuck.
+
+### New features
+
+New theme: [yoncé](https://codemirror.net/5/demo/theme.html#yonce).
+
+[xml-hint addon](https://codemirror.net/5/doc/manual.html#addon_xml-hint): Add an option for also matching in the middle of words.
+
+## 5.44.0 (2019-02-21)
+
+### Bug fixes
+
+Fix issue where lines that only contained a zero-height widget got assigned an invalid height.
+
+Improve support for middle-click paste on X Windows.
+
+Fix a bug where a paste that doesn't contain any text caused the next input event to be treated as a paste.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Fix accidental global variable.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Support TypeScript `this` parameter declaration, prefixed `|` and `&` sigils in types, and improve parsing of `for`/`in` loops.
+
+### New features
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Properly emulate forward-delete.
+
+New theme: [nord](https://codemirror.net/5/demo/theme.html#nord).
+
+## 5.43.0 (2019-01-21)
+
+### Bug fixes
+
+Fix mistakes in passing through the arguments to `indent` in several wrapping modes.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Fix parsing for a number of new and obscure TypeScript features.
+
+[ruby mode](https://codemirror.net/5/mode/ruby): Support indented end tokens for heredoc strings.
+
+### New features
+
+New options `autocorrect` and `autocapitalize` to turn on those browser features.
+
+## 5.42.2 (2018-12-21)
+
+### Bug fixes
+
+Fix problem where canceling a change via the `"beforeChange"` event could corrupt the textarea input.
+
+Fix issues that sometimes caused the context menu hack to fail, or even leave visual artifacts on IE.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Make it possible to select text between angle brackets.
+
+[css mode](https://codemirror.net/5/mode/css/): Fix tokenizing of CSS variables.
+
+[python mode](https://codemirror.net/5/mode/python/): Fix another bug in tokenizing of format strings.
+
+[soy mode](https://codemirror.net/5/mode/soy/): More accurate highlighting.
+
+## 5.42.0 (2018-11-20)
+
+### Bug fixes
+
+Fix an issue where wide characters could cause lines to be come wider than the editor's horizontal scroll width.
+
+Optimize handling of window resize events.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Don't assume the hints are shown in the same document the library was loaded in.
+
+[python mode](https://codemirror.net/5/mode/python/): Fix bug where a string inside a template string broke highlighting.
+
+[swift mode](https://codemirror.net/5/mode/swift): Support multi-line strings.
+
+### New features
+
+The [`markText` method](https://codemirror.net/5/doc/manual.html#markText) now takes an [`attributes`](https://codemirror.net/5/doc/manual.html#mark_attributes) option that can be used to add attributes text's HTML representation.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Add support for the `=` binding.
+
+## 5.41.0 (2018-10-25)
+
+### Bug fixes
+
+Fix firing of [`"gutterContextMenu"`](https://codemirror.net/5/doc/manual.html#event_gutterContextMenu) event on Firefox.
+
+Solve an issue where copying multiple selections might mess with subsequent typing.
+
+Don't crash when [`endOperation`](https://codemirror.net/5/doc/manual.html#endOperation) is called with no operation active.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Fix insert mode repeat after visualBlock edits.
+
+[scheme mode](https://codemirror.net/5/mode/scheme/index.html): Improve highlighting of quoted expressions.
+
+[soy mode](https://codemirror.net/5/mode/soy/): Support injected data and `@param` in comments.
+
+[objective c mode](https://codemirror.net/5/mode/clike/): Improve conformance to the actual language.
+
+### New features
+
+A new [`selectionsMayTouch`](https://codemirror.net/5/doc/manual.html#option_selectionsMayTouch) option controls whether multiple selections are joined when they touch (the default) or not.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Add `noremap` binding command.
+
+## 5.40.2 (2018-09-20)
+
+### Bug fixes
+
+Fix firing of `gutterContextMenu` event on Firefox.
+
+Add `hintWords` (basic completion) helper to [clojure](https://codemirror.net/5/mode/clojure/index.html), [mllike](https://codemirror.net/5/mode/mllike/index.html), [julia](https://codemirror.net/5/mode/julia/), [shell](https://codemirror.net/5/mode/shell/), and [r](https://codemirror.net/5/mode/r/) modes.
+
+[clojure mode](https://codemirror.net/5/mode/clojure/index.html): Clean up and improve.
+
+## 5.40.0 (2018-08-25)
+
+### Bug fixes
+
+[closebrackets addon](https://codemirror.net/5/doc/manual.html#addon_closebrackets): Fix issue where bracket-closing wouldn't work before punctuation.
+
+[panel addon](https://codemirror.net/5/doc/manual.html#addon_panel): Fix problem where replacing the last remaining panel dropped the newly added panel.
+
+[hardwrap addon](https://codemirror.net/5/doc/manual.html#addon_hardwrap): Fix an infinite loop when the indentation is greater than the target column.
+
+[jinja2](https://codemirror.net/5/mode/jinja2/) and [markdown](https://codemirror.net/5/mode/markdown/) modes: Add comment metadata.
+
+### New features
+
+New method [`phrase`](https://codemirror.net/5/doc/manual.html#phrase) and option [`phrases`](https://codemirror.net/5/doc/manual.html#option_phrases) to make translating UI text in addons easier.
+
+## 5.39.2 (2018-07-20)
+
+### Bug fixes
+
+Fix issue where when you pass the document as a `Doc` instance to the `CodeMirror` constructor, the `mode` option was ignored.
+
+Fix bug where line height could be computed wrong with a line widget below a collapsed line.
+
+Fix overeager `.npmignore` dropping the `bin/source-highlight` utility from the distribution.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Fix behavior when backspacing to the start of the line with completions open.
+
+## 5.39.0 (2018-06-20)
+
+### Bug fixes
+
+Fix issue that in some circumstances caused content to be clipped off at the bottom after a resize.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Improve handling of blank lines in HTML tags.
+
+### New features
+
+[stex mode](https://codemirror.net/5/mode/stex/): Add an `inMathMode` option to start the mode in math mode.
+
+## 5.38.0 (2018-05-21)
+
+### Bug fixes
+
+Improve reliability of noticing a missing mouseup event during dragging.
+
+Make sure `getSelection` is always called on the correct document.
+
+Fix interpretation of line breaks and non-breaking spaces inserted by renderer in contentEditable mode.
+
+Work around some browsers inexplicably making the fake scrollbars focusable.
+
+Make sure `coordsChar` doesn't return positions inside collapsed ranges.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Support block scopes, bindingless catch, bignum suffix, `s` regexp flag.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Adjust a wasteful regexp.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Allow opening the control without any item selected.
+
+### New features
+
+New theme: [darcula](https://codemirror.net/5/demo/theme.html#darcula).
+
+[dialog addon](https://codemirror.net/5/doc/manual.html#addon_dialog): Add a CSS class (`dialog-opened`) to the editor when a dialog is open.
+
+## 5.37.0 (2018-04-20)
+
+### Bug fixes
+
+Suppress keypress events during composition, for platforms that don't properly do this themselves.
+
+[xml-fold addon](https://codemirror.net/5/demo/folding.html): Improve handling of line-wrapped opening tags.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Improve TypeScript support.
+
+[python mode](https://codemirror.net/5/mode/python/): Highlight expressions inside format strings.
+
+### New features
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Add support for '(' and ')' movement.
+
+New themes: [idea](https://codemirror.net/5/demo/theme.html#idea), [ssms](https://codemirror.net/5/demo/theme.html#ssms), [gruvbox-dark](https://codemirror.net/5/demo/theme.html#gruvbox-dark).
+
+## 5.36.0 (2018-03-20)
+
+### Bug fixes
+
+Make sure all document-level event handlers are registered on the document that the editor is part of.
+
+Fix issue that prevented edits whose origin starts with `+` from being combined in history events for an editor-less document.
+
+[multiplex addon](https://codemirror.net/5/demo/multiplex.html): Improve handling of indentation.
+
+[merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): Use CSS `:after` element to style the scroll-lock icon.
+
+[javascript-hint addon](https://codemirror.net/5/doc/manual.html#addon_javascript-hint): Don't provide completions in JSON mode.
+
+[continuelist addon](https://codemirror.net/5/doc/manual.html#addon_continuelist): Fix numbering error.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Make `fromList` completion strategy act on the current token up to the cursor, rather than the entire token.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Fix a regexp with potentially exponental complexity.
+
+### New features
+
+New theme: [lucario](https://codemirror.net/5/demo/theme.html#lucario).
+
+## 5.35.0 (2018-02-20)
+
+### Bug fixes
+
+Fix problem where selection undo might change read-only documents.
+
+Fix crash when calling `addLineWidget` on a document that has no attached editor.
+
+[searchcursor addon](https://codemirror.net/5/doc/manual.html#addon_searchcursor): Fix behavior of `^` in multiline regexp mode.
+
+[match-highlighter addon](https://codemirror.net/5/doc/manual.html#addon_match-highlighter): Fix problem with matching words that have regexp special syntax in them.
+
+[sublime bindings](https://codemirror.net/5/demo/sublime.html): Fix `addCursorToSelection` for short lines.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Support TypeScript intersection types, dynamic `import`.
+
+[stex mode](https://codemirror.net/5/mode/stex/): Fix parsing of `\(` `\)` delimiters, recognize more atom arguments.
+
+[haskell mode](https://codemirror.net/5/mode/haskell/): Highlight more builtins, support `<*` and `*>`.
+
+[sql mode](https://codemirror.net/5/mode/sql/): Make it possible to disable backslash escapes in strings for dialects that don't have them, do this for MS SQL.
+
+[dockerfile mode](https://codemirror.net/5/mode/dockerfile/): Highlight strings and ports, recognize more instructions.
+
+### New features
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Support alternative delimiters in replace command.
+
+## 5.34.0 (2018-01-29)
+
+### Bug fixes
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Fix a problem where inline styles would persist across list items.
+
+[sublime bindings](https://codemirror.net/5/demo/sublime.html): Fix the `toggleBookmark` command.
+
+[closebrackets addon](https://codemirror.net/5/doc/manual.html#addon_closebrackets): Improve behavior when closing triple quotes.
+
+[xml-fold addon](https://codemirror.net/5/demo/folding.html): Fix folding of line-broken XML tags.
+
+[shell mode](https://codemirror.net/5/mode/shell/): Better handling of nested quoting.
+
+[javascript-lint addon](https://codemirror.net/5/demo/lint.html): Clean up and simplify.
+
+[matchbrackets addon](https://codemirror.net/5/doc/manual.html#addon_matchbrackets): Fix support for multiple editors at the same time.
+
+### New features
+
+New themes: [oceanic-next](https://codemirror.net/5/demo/theme.html#oceanic-next) and [shadowfox](https://codemirror.net/5/demo/theme.html#shadowfox).
+
+## 5.33.0 (2017-12-21)
+
+### Bug fixes
+
+[lint addon](https://codemirror.net/5/doc/manual.html#addon_lint): Make updates more efficient.
+
+[css mode](https://codemirror.net/5/mode/css/): The mode is now properly case-insensitive.
+
+[continuelist addon](https://codemirror.net/5/doc/manual.html#addon_continuelist): Fix broken handling of unordered lists introduced in previous release.
+
+[swift](https://codemirror.net/5/mode/swift) and [scala](https://codemirror.net/5/mode/clike/) modes: Support nested block comments.
+
+[mllike mode](https://codemirror.net/5/mode/mllike/index.html): Improve OCaml support.
+
+[sublime bindings](https://codemirror.net/5/demo/sublime.html): Use the proper key bindings for `addCursorToNextLine` and `addCursorToPrevLine`.
+
+### New features
+
+[jsx mode](https://codemirror.net/5/mode/jsx/index.html): Support JSX fragments.
+
+[closetag addon](https://codemirror.net/5/demo/closetag.html): Add an option to disable auto-indenting.
+
+## 5.32.0 (2017-11-22)
+
+### Bug fixes
+
+Increase contrast on default bracket-matching colors.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Recognize TypeScript type parameters for calls, type guards, and type parameter defaults. Improve handling of `enum` and `module` keywords.
+
+[comment addon](https://codemirror.net/5/doc/manual.html#addon_comment): Fix bug when uncommenting a comment that spans all but the last selected line.
+
+[searchcursor addon](https://codemirror.net/5/doc/manual.html#addon_searchcursor): Fix bug in case folding.
+
+[emacs bindings](https://codemirror.net/5/demo/emacs.html): Prevent single-character deletions from resetting the kill ring.
+
+[closebrackets addon](https://codemirror.net/5/doc/manual.html#addon_closebrackets): Tweak quote matching behavior.
+
+### New features
+
+[continuelist addon](https://codemirror.net/5/doc/manual.html#addon_continuelist): Increment ordered list numbers when adding one.
+
+## 5.31.0 (2017-10-20)
+
+### Bug fixes
+
+Further improve selection drawing and cursor motion in right-to-left documents.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Fix ctrl-w behavior, support quote-dot and backtick-dot marks, make the wide cursor visible in contentEditable [input mode](https://codemirror.net/5/doc/manual.html#option_contentEditable).
+
+[continuecomment addon](https://codemirror.net/5/doc/manual.html#addon_continuecomment): Fix bug when pressing enter after a single-line block comment.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Fix issue with leaving indented fenced code blocks.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Fix bad parsing of operators without spaces between them. Fix some corner cases around semicolon insertion and regexps.
+
+### New features
+
+Modes added with [`addOverlay`](https://codemirror.net/5/doc/manual.html#addOverlay) now have access to a [`baseToken`](https://codemirror.net/5/doc/manual.html#baseToken) method on their input stream, giving access to the tokens of the underlying mode.
+
+## 5.30.0 (2017-09-20)
+
+### Bug fixes
+
+Fixed a number of issues with drawing right-to-left selections and mouse selection in bidirectional text.
+
+[search addon](https://codemirror.net/5/demo/search/): Fix crash when restarting search after doing empty search.
+
+[mark-selection addon](http://cm/doc/manual.html#addon_mark-selection): Fix off-by-one bug.
+
+[tern addon](https://codemirror.net/5/demo/tern.html): Fix bad request made when editing at the bottom of a large document.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Improve parsing in a number of corner cases.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Fix crash when a sub-mode doesn't support indentation, allow uppercase X in task lists.
+
+[gfm mode](https://codemirror.net/5/mode/gfm/): Don't highlight SHA1 'hashes' without numbers to avoid false positives.
+
+[soy mode](https://codemirror.net/5/mode/soy/): Support injected data and `@param` in comments.
+
+### New features
+
+[simple mode addon](https://codemirror.net/5/demo/simplemode.html): Allow groups in regexps when `token` isn't an array.
+
+## 5.29.0 (2017-08-24)
+
+### Bug fixes
+
+Fix crash in contentEditable input style when editing near a bookmark.
+
+Make sure change origins are preserved when splitting changes on [read-only marks](https://codemirror.net/5/doc/manual.html#mark_readOnly).
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): More support for TypeScript syntax.
+
+[d mode](https://codemirror.net/5/mode/d/): Support nested comments.
+
+[python mode](https://codemirror.net/5/mode/python/): Improve tokenizing of operators.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Further improve CommonMark conformance.
+
+[css mode](https://codemirror.net/5/mode/css/): Don't run comment tokens through the mode's state machine.
+
+[shell mode](https://codemirror.net/5/mode/shell/): Allow strings to span lines.
+
+[search addon](https://codemirror.net/5/demo/search/): Fix crash in persistent search when `extraKeys` is null.
+
+## 5.28.0 (2017-07-21)
+
+### Bug fixes
+
+Fix copying of, or replacing editor content with, a single dash character when copying a big selection in some corner cases.
+
+Make [`"goLineLeft"`](https://codemirror.net/5/doc/manual.html#command_goLineLeft)/`"goLineRight"` behave better on wrapped lines.
+
+[sql mode](https://codemirror.net/5/mode/sql/): Fix tokenizing of multi-dot operator and allow digits in subfield names.
+
+[searchcursor addon](https://codemirror.net/5/doc/manual.html#addon_searchcursor): Fix infinite loop on some composed character inputs.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Make list parsing more CommonMark-compliant.
+
+[gfm mode](https://codemirror.net/5/mode/gfm/): Highlight colon syntax for emoji.
+
+### New features
+
+Expose [`startOperation`](https://codemirror.net/5/doc/manual.html#startOperation) and `endOperation` for explicit operation management.
+
+[sublime bindings](https://codemirror.net/5/demo/sublime.html): Add extend-selection (Ctrl-Alt- or Cmd-Shift-Up/Down).
+
+## 5.27.4 (2017-06-29)
+
+### Bug fixes
+
+Fix crash when using mode lookahead.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Don't block inner mode's indentation support.
+
+## 5.27.2 (2017-06-22)
+
+### Bug fixes
+
+Fix crash in the [simple mode](https://codemirror.net/5/demo/simplemode.html)< addon.
+
+## 5.27.0 (2017-06-22)
+
+### Bug fixes
+
+Fix infinite loop in forced display update.
+
+Properly disable the hidden textarea when `readOnly` is `"nocursor"`.
+
+Calling the `Doc` constructor without `new` works again.
+
+[sql mode](https://codemirror.net/5/mode/sql/): Handle nested comments.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Improve support for TypeScript syntax.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Fix bug where markup was ignored on indented paragraph lines.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Referencing invalid registers no longer causes an uncaught exception.
+
+[rust mode](https://codemirror.net/5/mode/rust/): Add the correct MIME type.
+
+[matchbrackets addon](https://codemirror.net/5/doc/manual.html#addon_matchbrackets): Document options.
+
+### New features
+
+Mouse button clicks can now be bound in keymaps by using names like `"LeftClick"` or `"Ctrl-Alt-MiddleTripleClick"`. When bound to a function, that function will be passed the position of the click as second argument.
+
+The behavior of mouse selection and dragging can now be customized with the [`configureMouse`](https://codemirror.net/5/doc/manual.html#option_configureMouse) option.
+
+Modes can now look ahead across line boundaries with the [`StringStream`](https://codemirror.net/5/doc/manual.html#StringStream)`.lookahead` method.
+
+Introduces a `"type"` token type, makes modes that recognize types output it, and add styling for it to the themes.
+
+New [`pasteLinesPerSelection`](https://codemirror.net/5/doc/manual.html#option_pasteLinesPerSelection) option to control the behavior of pasting multiple lines into multiple selections.
+
+[searchcursor addon](https://codemirror.net/5/doc/manual.html#addon_searchcursor): Support multi-line regular expression matches, and normalize strings when matching.
+
+## 5.26.0 (2017-05-22)
+
+### Bug fixes
+
+In textarea-mode, don't reset the input field during composition.
+
+More careful restoration of selections in widgets, during editor redraw.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): More TypeScript parsing fixes.
+
+[julia mode](https://codemirror.net/5/mode/julia/): Fix issue where the mode gets stuck.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Understand cross-line links, parse all bracketed things as links.
+
+[soy mode](https://codemirror.net/5/mode/soy/): Support single-quoted strings.
+
+[go mode](https://codemirror.net/5/mode/go/): Don't try to indent inside strings or comments.
+
+### New features
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Parse line offsets in line or range specs.
+
+## 5.25.2 (2017-04-20)
+
+### Bug fixes
+
+Better handling of selections that cover the whole viewport in contentEditable-mode.
+
+No longer accidentally scroll the editor into view when calling `setValue`.
+
+Work around Chrome Android bug when converting screen coordinates to editor positions.
+
+Make sure long-clicking a selection sets a cursor and doesn't show the editor losing focus.
+
+Fix issue where pointer events were incorrectly disabled on Chrome's overlay scrollbars.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Recognize annotations and TypeScript-style type parameters.
+
+[shell mode](https://codemirror.net/5/mode/shell/): Handle nested braces.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Make parsing of strong/em delimiters CommonMark-compliant.
+
+## 5.25.0 (2017-03-20)
+
+### Bug fixes
+
+In contentEditable-mode, properly locate changes that repeat a character when inserted with IME.
+
+Fix handling of selections bigger than the viewport in contentEditable mode.
+
+Improve handling of changes that insert or delete lines in contentEditable mode.
+
+Count Unicode control characters 0x80 to 0x9F as special (non-printing) chars.
+
+Fix handling of shadow DOM roots when finding the active element.
+
+Add `role=presentation` to more DOM elements to improve screen reader support.
+
+[merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): Make aligning of unchanged chunks more robust.
+
+[comment addon](https://codemirror.net/5/doc/manual.html#addon_comment): Fix comment-toggling on a block of text that starts and ends in a (different) block comment.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Improve support for TypeScript syntax.
+
+[r mode](https://codemirror.net/5/mode/r/): Fix indentation after semicolon-less statements.
+
+[shell mode](https://codemirror.net/5/mode/shell/): Properly handle escaped parentheses in parenthesized expressions.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Fix a few bugs around leaving fenced code blocks.
+
+[soy mode](https://codemirror.net/5/mode/soy/): Improve indentation.
+
+### New features
+
+[lint addon](https://codemirror.net/5/doc/manual.html#addon_lint): Support asynchronous linters that return promises.
+
+[continuelist addon](https://codemirror.net/5/doc/manual.html#addon_continuelist): Support continuing task lists.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Make Y behave like yy.
+
+[sql mode](https://codemirror.net/5/mode/sql/): Support sqlite dialect.
+
+## 5.24.2 (2017-02-22)
+
+### Bug fixes
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Support computed class method names.
+
+[merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): Improve aligning of unchanged code in the presence of marks and line widgets.
+
+## 5.24.0 (2017-02-20)
+
+### Bug fixes
+
+A cursor directly before a line-wrapping break is now drawn before or after the line break depending on which direction you arrived from.
+
+Visual cursor motion in line-wrapped right-to-left text should be much more correct.
+
+Fix bug in handling of read-only marked text.
+
+[shell mode](https://codemirror.net/5/mode/shell/): Properly tokenize nested parentheses.
+
+[python mode](https://codemirror.net/5/mode/python/): Support underscores in number literals.
+
+[sass mode](https://codemirror.net/5/mode/sass/): Uses the full list of CSS properties and keywords from the CSS mode, rather than defining its own incomplete subset.
+
+[css mode](https://codemirror.net/5/mode/css/): Expose `lineComment` property for LESS and SCSS dialects. Recognize vendor prefixes on pseudo-elements.
+
+[julia mode](https://codemirror.net/5/mode/julia/): Properly indent `elseif` lines.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Properly recognize the end of fenced code blocks when inside other markup.
+
+[scala mode](https://codemirror.net/5/mode/clike/): Improve handling of operators containing #, @, and : chars.
+
+[xml mode](https://codemirror.net/5/mode/xml/): Allow dashes in HTML tag names.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Improve parsing of async methods, TypeScript-style comma-separated superclass lists.
+
+[indent-fold addon](https://codemirror.net/5/demo/folding.html): Ignore comment lines.
+
+### New features
+
+Positions now support a `sticky` property which determines whether they should be associated with the character before (value `"before"`) or after (value `"after"`) them.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Make it possible to remove built-in bindings through the API.
+
+[comment addon](https://codemirror.net/5/doc/manual.html#addon_comment): Support a per-mode useInnerComments option to optionally suppress descending to the inner modes to get comment strings.
+
+### Breaking changes
+
+The [sass mode](https://codemirror.net/5/mode/sass/) now depends on the [css mode](https://codemirror.net/5/mode/css/).
+
+## 5.23.0 (2017-01-19)
+
+### Bug fixes
+
+Presentation-related elements DOM elements are now marked as such to help screen readers.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Be more picky about what HTML tags look like to avoid false positives.
+
+### New features
+
+`findModeByMIME` now understands `+json` and `+xml` MIME suffixes.
+
+[closebrackets addon](https://codemirror.net/5/doc/manual.html#addon_closebrackets): Add support for an `override` option to ignore language-specific defaults.
+
+[panel addon](https://codemirror.net/5/doc/manual.html#addon_panel): Add a `stable` option that auto-scrolls the content to keep it in the same place when inserting/removing a panel.
+
+## 5.22.2 (2017-01-12)
+
+### Bug fixes
+
+Include rollup.config.js in NPM package, so that it can be used to build from source.
+
+## 5.22.0 (2016-12-20)
+
+### Bug fixes
+
+[sublime bindings](https://codemirror.net/5/demo/sublime.html): Make `selectBetweenBrackets` work with multiple cursors.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Fix issues with parsing complex TypeScript types, imports, and exports.
+
+A contentEditable editor instance with autofocus enabled no longer crashes during initializing.
+
+### New features
+
+[emacs bindings](https://codemirror.net/5/demo/emacs.html): Export `CodeMirror.emacs` to allow other addons to hook into Emacs-style functionality.
+
+[active-line addon](https://codemirror.net/5/doc/manual.html#addon_active-line): Add `nonEmpty` option.
+
+New event: [`optionChange`](https://codemirror.net/5/doc/manual.html#event_optionChange).
+
+## 5.21.0 (2016-11-21)
+
+### Bug fixes
+
+Tapping/clicking the editor in [contentEditable mode](https://codemirror.net/5/doc/manual.html#option_inputStyle) on Chrome now puts the cursor at the tapped position.
+
+Fix various crashes and misbehavior when reading composition events in [contentEditable mode](https://codemirror.net/5/doc/manual.html#option_inputStyle).
+
+Catches and ignores an IE 'Unspecified Error' when creating an editor in an iframe before there is a ``.
+
+[merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): Fix several issues in the chunk-aligning feature.
+
+[verilog mode](https://codemirror.net/5/mode/verilog): Rewritten to address various issues.
+
+[julia mode](https://codemirror.net/5/mode/julia): Recognize Julia 0.5 syntax.
+
+[swift mode](https://codemirror.net/5/mode/swift): Various fixes and adjustments to current syntax.
+
+[markdown mode](https://codemirror.net/5/mode/markdown): Allow lists without a blank line above them.
+
+### New features
+
+The [`setGutterMarker`](https://codemirror.net/5/doc/manual.html#setGutterMarker), [`clearGutter`](https://codemirror.net/5/doc/manual.html#clearGutter), and [`lineInfo`](https://codemirror.net/5/doc/manual.html#lineInfo) methods are now available on `Doc` objects.
+
+The [`heightAtLine`](https://codemirror.net/5/doc/manual.html#heightAtLine) method now takes an extra argument to allow finding the height at the top of the line's line widgets.
+
+[ruby mode](https://codemirror.net/5/mode/ruby): `else` and `elsif` are now immediately indented.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Bind Ctrl-T and Ctrl-D to in- and dedent in insert mode.
+
+## 5.20.2 (2016-10-21)
+
+### Bug fixes
+
+Fix `CodeMirror.version` returning the wrong version number.
+
+## 5.20.0 (2016-10-20)
+
+### Bug fixes
+
+Make `newlineAndIndent` command work with multiple cursors on the same line.
+
+Make sure keypress events for backspace are ignored.
+
+Tokens styled with overlays no longer get a nonsense `cm-cm-overlay` class.
+
+Line endings for pasted content are now normalized to the editor's [preferred ending](https://codemirror.net/5/doc/manual.html#option_lineSeparator).
+
+[javascript mode](https://codemirror.net/5/mode/javascript): Improve support for class expressions. Support TypeScript optional class properties, the `abstract` keyword, and return type declarations for arrow functions.
+
+[css mode](https://codemirror.net/5/mode/css): Fix highlighting of mixed-case keywords.
+
+[closebrackets addon](https://codemirror.net/5/doc/manual.html#addon_closebrackets): Improve behavior when typing a quote before a string.
+
+### New features
+
+The core is now maintained as a number of small files, using ES6 syntax and modules, under the `src/` directory. A git checkout no longer contains a working `codemirror.js` until you `npm run build` (but when installing from NPM, it is included).
+
+The [`refresh`](https://codemirror.net/5/doc/manual.html#event_refresh) event is now documented and stable.
+
+## 5.19.0 (2016-09-20)
+
+### Bugfixes
+
+[erlang mode](https://codemirror.net/5/mode/erlang): Fix mode crash when trying to read an empty context.
+
+[comment addon](https://codemirror.net/5/doc/manual.html#addon_comment): Fix broken behavior when toggling comments inside a comment.
+
+xml-fold addon: Fix a null-dereference bug.
+
+Page up and page down now do something even in single-line documents.
+
+Fix an issue where the cursor position could be off in really long (~8000 character) tokens.
+
+### New features
+
+[javascript mode](https://codemirror.net/5/mode/javascript): Better indentation when semicolons are missing. Better support for TypeScript classes, optional parameters, and the `type` keyword.
+
+The [`blur`](https://codemirror.net/5/doc/manual.html#event_blur) and [`focus`](https://codemirror.net/5/doc/manual.html#event_focus) events now pass the DOM event to their handlers.
+
+## 5.18.2 (2016-08-23)
+
+### Bugfixes
+
+[vue mode](https://codemirror.net/5/mode/vue): Fix outdated references to renamed Pug mode dependency.
+
+## 5.18.0 (2016-08-22)
+
+### Bugfixes
+
+Make sure [gutter backgrounds](https://codemirror.net/5/doc/manual.html#addLineClass) stick to the rest of the gutter during horizontal scrolling.
+
+The contenteditable [`inputStyle`](https://codemirror.net/5/doc/manual.html#option_inputStyle) now properly supports pasting on pre-Edge IE versions.
+
+[javascript mode](https://codemirror.net/5/mode/javascript): Fix some small parsing bugs and improve TypeScript support.
+
+[matchbrackets addon](https://codemirror.net/5/doc/manual.html#addon_matchbrackets): Fix bug where active highlighting was left in editor when the addon was disabled.
+
+[match-highlighter addon](https://codemirror.net/5/doc/manual.html#addon_match-highlighter): Only start highlighting things when the editor gains focus.
+
+[javascript-hint addon](https://codemirror.net/5/doc/manual.html#addon_javascript-hint): Also complete non-enumerable properties.
+
+### New features
+
+The [`addOverlay`](https://codemirror.net/5/doc/manual.html#addOverlay) method now supports a `priority` option to control the order in which overlays are applied.
+
+MIME types that end in `+json` now default to the JSON mode when the MIME itself is not defined.
+
+### Breaking changes
+
+The mode formerly known as Jade was renamed to [Pug](https://codemirror.net/5/mode/pug).
+
+The [Python mode](https://codemirror.net/5/mode/python) now defaults to Python 3 (rather than 2) syntax.
+
+## 5.17.0 (2016-07-19)
+
+### Bugfixes
+
+Fix problem with wrapped trailing whitespace displaying incorrectly.
+
+Prevent IME dialog from overlapping typed content in Chrome.
+
+Improve measuring of characters near a line wrap.
+
+[javascript mode](https://codemirror.net/5/mode/javascript): Improve support for `async`, allow trailing commas in `import` lists.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Fix backspace in replace mode.
+
+[sublime bindings](https://codemirror.net/5/demo/sublime.html): Fix some key bindings on OS X to match Sublime Text.
+
+### New features
+
+[markdown mode](https://codemirror.net/5/mode/markdown): Add more classes to image links in highlight-formatting mode.
+
+## 5.16.0 (2016-06-20)
+
+### Bugfixes
+
+Fix glitches when dragging content caused by the drop indicator receiving mouse events.
+
+Make Control-drag work on Firefox.
+
+Make clicking or selection-dragging at the end of a wrapped line select the right position.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Prevent widget scrollbar from hiding part of the hint text.
+
+[rulers addon](https://codemirror.net/5/doc/manual.html#addon_rulers): Prevent rulers from forcing a horizontal editor scrollbar.
+
+### New features
+
+[search addon](https://codemirror.net/5/doc/manual.html#addon_search): Automatically bind search-related keys in persistent dialog.
+
+[sublime keymap](https://codemirror.net/5/demo/sublime.html): Add a multi-cursor aware smart backspace binding.
+
+## 5.15.2 (2016-05-20)
+
+### Bugfixes
+
+Fix a critical document corruption bug that occurs when a document is gradually grown.
+
+## 5.15.0 (2016-05-20)
+
+### Bugfixes
+
+Fix bug that caused the selection to reset when focusing the editor in contentEditable input mode.
+
+Fix issue where not all ASCII control characters were being replaced by placeholders.
+
+Remove the assumption that all modes have a `startState` method from several wrapping modes.
+
+Fix issue where the editor would complain about overlapping collapsed ranges when there weren't any.
+
+Optimize document tree building when loading or pasting huge chunks of content.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Fix several issues in matching link targets.
+
+[clike mode](https://codemirror.net/5/mode/clike/): Improve indentation of C++ template declarations.
+
+### New features
+
+Explicitly bind Ctrl-O on OS X to make that binding (“open line”) act as expected.
+
+Pasting [linewise-copied](https://codemirror.net/5/doc/manual.html#option_lineWiseCopyCut) content when there is no selection now inserts the lines above the current line.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Support `async`/`await` and improve support for TypeScript type syntax.
+
+## 5.14.2 (2016-04-20)
+
+### Bugfixes
+
+Push a new package to NPM due to an [NPM bug](https://github.com/npm/npm/issues/5082) omitting the LICENSE file in 5.14.0.
+
+Set `dataTransfer.effectAllowed` in `dragstart` handler to help browsers use the right drag icon.
+
+Add the [mbox mode](https://codemirror.net/5/mode/mbox/index.html) to `mode/meta.js`.
+
+## 5.14.0 (2016-04-20)
+
+### Bugfixes
+
+[`posFromIndex`](https://codemirror.net/5/doc/manual.html#posFromIndex) and [`indexFromPos`](https://codemirror.net/5/doc/manual.html#indexFromPos) now take [`lineSeparator`](https://codemirror.net/5/doc/manual.html#option_lineSeparator) into account.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Only call `.save()` when it is actually available.
+
+[comment addon](https://codemirror.net/5/doc/manual.html#addon_comment): Be careful not to mangle multi-line strings.
+
+[Python mode](https://codemirror.net/5/mode/python/index.html): Improve distinguishing of decorators from `@` operators.
+
+[`findMarks`](https://codemirror.net/5/doc/manual.html#findMarks): No longer return marks that touch but don't overlap given range.
+
+### New features
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Add yank command.
+
+[match-highlighter addon](https://codemirror.net/5/doc/manual.html#addon_match-highlighter): Add `trim` option to disable ignoring of whitespace.
+
+[PowerShell mode](https://codemirror.net/5/mode/powershell/index.html): Added.
+
+[Yacas mode](https://codemirror.net/5/mode/yacas/index.html): Added.
+
+[Web IDL mode](https://codemirror.net/5/mode/webidl/index.html): Added.
+
+[SAS mode](https://codemirror.net/5/mode/sas/index.html): Added.
+
+[mbox mode](https://codemirror.net/5/mode/mbox/index.html): Added.
+
+## 5.13.2 (2016-03-23)
+
+### Bugfixes
+
+Solves a problem where the gutter would sometimes not extend all the way to the end of the document.
+
+## 5.13.0 (2016-03-21)
+
+### New features
+
+New DOM event forwarded: [`"dragleave"`](https://codemirror.net/5/doc/manual.html#event_dom).
+
+[protobuf mode](https://codemirror.net/5/mode/protobuf/index.html): Newly added.
+
+### Bugfixes
+
+Fix problem where [`findMarks`](https://codemirror.net/5/doc/manual.html#findMarks) sometimes failed to find multi-line marks.
+
+Fix crash that showed up when atomic ranges and bidi text were combined.
+
+[show-hint addon](https://codemirror.net/5/demo/complete.html): Completion widgets no longer close when the line indented or dedented.
+
+[merge addon](https://codemirror.net/5/demo/merge.html): Fix bug when merging chunks at the end of the file.
+
+[placeholder addon](https://codemirror.net/5/doc/manual.html#addon_placeholder): No longer gets confused by [`swapDoc`](https://codemirror.net/5/doc/manual.html#swapDoc).
+
+[simplescrollbars addon](https://codemirror.net/5/doc/manual.html#addon_simplescrollbars): Fix invalid state when deleting at end of document.
+
+[clike mode](https://codemirror.net/5/mode/clike/index.html): No longer gets confused when a comment starts after an operator.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/index.html): Now supports CommonMark-style flexible list indentation.
+
+[dylan mode](https://codemirror.net/5/mode/dylan/index.html): Several improvements and fixes.
+
+## 5.12.0 (2016-02-19)
+
+### New features
+
+[Vim bindings](https://codemirror.net/5/demo/vim.html): Ctrl-Q is now an alias for Ctrl-V.
+
+[Vim bindings](https://codemirror.net/5/demo/vim.html): The Vim API now exposes an `unmap` method to unmap bindings.
+
+[active-line addon](https://codemirror.net/5/demo/activeline.html): This addon can now style the active line's gutter.
+
+[FCL mode](https://codemirror.net/5/mode/fcl/): Newly added.
+
+[SQL mode](https://codemirror.net/5/mode/sql/): Now has a Postgresql dialect.
+
+### Bugfixes
+
+Fix [issue](https://github.com/codemirror/CodeMirror/issues/3781) where trying to scroll to a horizontal position outside of the document's width could cause the gutter to be positioned incorrectly.
+
+Use absolute, rather than fixed positioning in the context-menu intercept hack, to work around a [problem](https://github.com/codemirror/CodeMirror/issues/3238) when the editor is inside a transformed parent container.
+
+Solve a [problem](https://github.com/codemirror/CodeMirror/issues/3821) where the horizontal scrollbar could hide text in Firefox.
+
+Fix a [bug](https://github.com/codemirror/CodeMirror/issues/3834) that caused phantom scroll space under the text in some situations.
+
+[Sublime Text bindings](https://codemirror.net/5/demo/sublime.html): Bind delete-line to Shift-Ctrl-K on OS X.
+
+[Markdown mode](https://codemirror.net/5/mode/markdown/): Fix [issue](https://github.com/codemirror/CodeMirror/issues/3787) where the mode would keep state related to fenced code blocks in an unsafe way, leading to occasional corrupted parses.
+
+[Markdown mode](https://codemirror.net/5/mode/markdown/): Ignore backslashes in code fragments.
+
+[Markdown mode](https://codemirror.net/5/mode/markdown/): Use whichever mode is registered as `text/html` to parse HTML.
+
+[Clike mode](https://codemirror.net/5/mode/clike/): Improve indentation of Scala `=>` functions.
+
+[Python mode](https://codemirror.net/5/mode/python/): Improve indentation of bracketed code.
+
+[HTMLMixed mode](https://codemirror.net/5/mode/htmlmixed/): Support multi-line opening tags for sub-languages (`
 
 
-
 

Alternatively, a character can be specified directly by surrounding it in single quotes, for example '$' or 'q'. Due to limitations in the way browsers fire key events, these may not be prefixed with modifiers.

-

The CodeMirror.keyMap object associates keymaps - with names. User code and keymap definitions can assign extra - properties to this object. Anywhere where a keymap is expected, a +

To bind mouse buttons, use the names `LeftClick`, + `MiddleClick`, and `RightClick`. These can also be prefixed with + modifiers, and in addition, the word `Double` or `Triple` can be + put before `Click` (as in `LeftDoubleClick`) to bind a double- or + triple-click. The function for such a binding is passed the + position that was clicked as second argument.

+ +

Multi-stroke key bindings can be specified + by separating the key names by spaces in the property name, for + example Ctrl-X Ctrl-V. When a map contains + multi-stoke bindings or keys with modifiers that are not specified + in the default order (Shift-Cmd-Ctrl-Alt), you must + call CodeMirror.normalizeKeyMap on it before it can + be used. This function takes a keymap and modifies it to normalize + modifier order and properly recognize multi-stroke bindings. It + will return the keymap itself.

+ +

The CodeMirror.keyMap object associates key maps + with names. User code and key map definitions can assign extra + properties to this object. Anywhere where a key map is expected, a string can be given, which will be looked up in this object. It - also contains the "default" keymap holding the + also contains the "default" key map holding the default bindings.

-

The values of properties in keymaps can be either functions of +

The values of properties in key maps can be either functions of a single argument (the CodeMirror instance), strings, or - false. Such strings refer to properties of the - CodeMirror.commands object, which defines a number of - common commands that are used by the default keybindings, and maps - them to functions. If the property is set to false, - CodeMirror leaves handling of the key up to the browser. A key - handler function may return CodeMirror.Pass to indicate - that it has decided not to handle the key, and other handlers (or - the default behavior) should be given a turn.

+ false. Strings refer + to commands, which are described below. If + the property is set to false, CodeMirror leaves + handling of the key up to the browser. A key handler function may + return CodeMirror.Pass to indicate that it has + decided not to handle the key, and other handlers (or the default + behavior) should be given a turn.

Keys mapped to command names that start with the - characters "go" (which should be used for + characters "go" or to functions that have a + truthy motion property (which should be used for cursor-movement actions) will be fired even when an extra Shift modifier is present (i.e. "Up": "goLineUp" matches both up and shift-up). This is used to easily implement shift-selection.

-

Keymaps can defer to each other by defining +

Key maps can defer to each other by defining a fallthrough property. This indicates that when a key is not found in the map itself, one or more other maps should - be searched. It can hold either a single keymap or an array of - keymaps.

- -

When a keymap contains a nofallthrough property - set to true, keys matched against that map will be - ignored if they don't match any of the bindings in the map (no - further child maps will be tried). When - the disableInput property is set - to true, the default effect of inserting a character - will be suppressed when the keymap is active as the top-level - map.

+ be searched. It can hold either a single key map or an array of + key maps.

+ +

When a key map needs to set something up when it becomes + active, or tear something down when deactivated, it can + contain attach and/or detach properties, + which should hold functions that take the editor instance and the + next or previous keymap. Note that this only works for the + top-level keymap, not for fallthrough + maps or maps added + with extraKeys + or addKeyMap.

+ + +
+

Commands

+ +

Commands are parameter-less actions that can be performed on an + editor. Their main use is for key bindings. Commands are defined by + adding properties to the CodeMirror.commands object. + A number of common commands are defined by the library itself, + most of them used by the default key bindings. The value of a + command property must be a function of one argument (an editor + instance).

+ +

Some of the commands below are referenced in the default + key map, but not defined by the core library. These are intended to + be defined by user code or addons.

+ +

Commands can also be run with + the execCommand + method.

+ +
+
selectAllCtrl-A (PC), Cmd-A (Mac)
+
Select the whole content of the editor.
+ +
singleSelectionEsc
+
When multiple selections are present, this deselects all but + the primary selection.
+ +
killLineCtrl-K (Mac)
+
Emacs-style line killing. Deletes the part of the line after + the cursor. If that consists only of whitespace, the newline at + the end of the line is also deleted.
+ +
deleteLineCtrl-D (PC), Cmd-D (Mac)
+
Deletes the whole line under the cursor, including newline at the end.
+ +
delLineLeft
+
Delete the part of the line before the cursor.
+ +
delWrappedLineLeftCmd-Backspace (Mac)
+
Delete the part of the line from the left side of the visual line the cursor is on to the cursor.
+ +
delWrappedLineRightCmd-Delete (Mac)
+
Delete the part of the line from the cursor to the right side of the visual line the cursor is on.
+ +
undoCtrl-Z (PC), Cmd-Z (Mac)
+
Undo the last change. Note that, because browsers still + don't make it possible for scripts to react to or customize the + context menu, selecting undo (or redo) from the context menu in + a CodeMirror instance does not work.
+ +
redoCtrl-Y (PC), Shift-Cmd-Z (Mac), Cmd-Y (Mac)
+
Redo the last undone change.
+ +
undoSelectionCtrl-U (PC), Cmd-U (Mac)
+
Undo the last change to the selection, or if there are no + selection-only changes at the top of the history, undo the last + change.
+ +
redoSelectionAlt-U (PC), Shift-Cmd-U (Mac)
+
Redo the last change to the selection, or the last text change if + no selection changes remain.
+ +
goDocStartCtrl-Home (PC), Cmd-Up (Mac), Cmd-Home (Mac)
+
Move the cursor to the start of the document.
+ +
goDocEndCtrl-End (PC), Cmd-End (Mac), Cmd-Down (Mac)
+
Move the cursor to the end of the document.
+ +
goLineStartAlt-Left (PC), Ctrl-A (Mac)
+
Move the cursor to the start of the line.
+ +
goLineStartSmartHome
+
Move to the start of the text on the line, or if we are + already there, to the actual start of the line (including + whitespace).
+ +
goLineEndAlt-Right (PC), Ctrl-E (Mac)
+
Move the cursor to the end of the line.
+ +
goLineRightCmd-Right (Mac)
+
Move the cursor to the right side of the visual line it is on.
+ +
goLineLeftCmd-Left (Mac)
+
Move the cursor to the left side of the visual line it is on. If + this line is wrapped, that may not be the start of the line.
+ +
goLineLeftSmart
+
Move the cursor to the left side of the visual line it is + on. If that takes it to the start of the line, behave + like goLineStartSmart.
+ +
goLineUpUp, Ctrl-P (Mac)
+
Move the cursor up one line.
+ +
goLineDownDown, Ctrl-N (Mac)
+
Move down one line.
+ +
goPageUpPageUp, Shift-Ctrl-V (Mac)
+
Move the cursor up one screen, and scroll up by the same distance.
+ +
goPageDownPageDown, Ctrl-V (Mac)
+
Move the cursor down one screen, and scroll down by the same distance.
+ +
goCharLeftLeft, Ctrl-B (Mac)
+
Move the cursor one character left, going to the previous line + when hitting the start of line.
+ +
goCharRightRight, Ctrl-F (Mac)
+
Move the cursor one character right, going to the next line + when hitting the end of line.
+ +
goColumnLeft
+
Move the cursor one character left, but don't cross line boundaries.
+ +
goColumnRight
+
Move the cursor one character right, don't cross line boundaries.
+ +
goWordLeftAlt-B (Mac)
+
Move the cursor to the start of the previous word.
+ +
goWordRightAlt-F (Mac)
+
Move the cursor to the end of the next word.
+ +
goGroupLeftCtrl-Left (PC), Alt-Left (Mac)
+
Move to the left of the group before the cursor. A group is + a stretch of word characters, a stretch of punctuation + characters, a newline, or a stretch of more than one + whitespace character.
+ +
goGroupRightCtrl-Right (PC), Alt-Right (Mac)
+
Move to the right of the group after the cursor + (see above).
+ +
delCharBeforeShift-Backspace, Ctrl-H (Mac)
+
Delete the character before the cursor.
+ +
delCharAfterDelete, Ctrl-D (Mac)
+
Delete the character after the cursor.
+ +
delWordBeforeAlt-Backspace (Mac)
+
Delete up to the start of the word before the cursor.
+ +
delWordAfterAlt-D (Mac)
+
Delete up to the end of the word after the cursor.
+ +
delGroupBeforeCtrl-Backspace (PC), Alt-Backspace (Mac)
+
Delete to the left of the group before the cursor.
+ +
delGroupAfterCtrl-Delete (PC), Ctrl-Alt-Backspace (Mac), Alt-Delete (Mac)
+
Delete to the start of the group after the cursor.
+ +
indentAutoShift-Tab
+
Auto-indent the current line or selection.
+ +
indentMoreCtrl-] (PC), Cmd-] (Mac)
+
Indent the current line or selection by one indent unit.
+ +
indentLessCtrl-[ (PC), Cmd-[ (Mac)
+
Dedent the current line or selection by one indent unit.
+ +
insertTab
+
Insert a tab character at the cursor.
+ +
insertSoftTab
+
Insert the amount of spaces that match the width a tab at + the cursor position would have.
+ +
defaultTabTab
+
If something is selected, indent it by + one indent unit. If nothing is + selected, insert a tab character.
+ +
transposeCharsCtrl-T (Mac)
+
Swap the characters before and after the cursor.
+ +
newlineAndIndentEnter
+
Insert a newline and auto-indent the new line.
+ +
toggleOverwriteInsert
+
Flip the overwrite flag.
+ +
saveCtrl-S (PC), Cmd-S (Mac)
+
Not defined by the core library, only referred to in + key maps. Intended to provide an easy way for user code to define + a save command.
+ +
findCtrl-F (PC), Cmd-F (Mac)
+
findNextCtrl-G (PC), Cmd-G (Mac)
+
findPrevShift-Ctrl-G (PC), Shift-Cmd-G (Mac)
+
replaceShift-Ctrl-F (PC), Cmd-Alt-F (Mac)
+
replaceAllShift-Ctrl-R (PC), Shift-Cmd-Alt-F (Mac)
+
Not defined by the core library, but defined in + the search addon (or custom client + addons).
+ +
+
@@ -750,16 +1161,12 @@

Customized Styling

The outer element of the editor. This should be used for the editor width, height, borders and positioning. Can also be used to set styles that should hold for everything inside the editor - (such as font and font size), or to set a background.
- -
CodeMirror-scroll
-
Whether the editor scrolls (overflow: auto + - fixed height). By default, it does. Setting - the CodeMirror class to have height: - auto and giving this class overflow-x: auto; - overflow-y: hidden; will cause the editor - to resize to fit its - content.
+ (such as font and font size), or to set a background. Setting + this class' height style to auto will + make the editor resize to fit its + content (it is recommended to also set + the viewportMargin + option to Infinity when doing this.
CodeMirror-focused
Whenever the editor is focused, the top element gets this @@ -825,7 +1232,11 @@

Programming API

shouldn't worry too much about sanitizing your coordinates. If you give ch a value of null, or don't specify it, it will be replaced with the length of the specified - line.

+ line. Such positions may also have a sticky property + holding "before" or "after", whether the + position is associated with the character before or after it. This + influences, for example, where the cursor is drawn on a + line-break or bidi-direction boundary.

Methods prefixed with doc. can, unless otherwise specified, be called both on CodeMirror (editor) @@ -869,29 +1280,30 @@

Content manipulation methods

should be {line, ch} objects. An optional third argument can be given to indicate the line separator string to use (defaults to "\n").
-
doc.replaceRange(replacement: string, from: {line, ch}, to: {line, ch})
+
doc.replaceRange(replacement: string, from: {line, ch}, to: {line, ch}, ?origin: string)
Replace the part of the document between from and to with the given string. from and to must be {line, ch} objects. to can be left off to simply insert the - string at position from.
+ string at position from. When origin + is given, it will be passed on + to "change" events, and + its first letter will be used to determine whether this change + can be merged with previous history events, in the way described + for selection origins.
doc.getLine(n: integer) → string
Get the content of line n.
-
doc.setLine(n: integer, text: string)
-
Set the content of line n.
-
doc.removeLine(n: integer)
-
Remove the given line from the document.
doc.lineCount() → integer
Get the number of lines in the editor.
doc.firstLine() → integer
-
Get the first line of the editor. This will +
Get the number of first line in the editor. This will usually be zero but for linked sub-views, or documents instantiated with a non-zero first line, it might return other values.
doc.lastLine() → integer
-
Get the last line of the editor. This will +
Get the number of last line in the editor. This will usually be doc.lineCount() - 1, but for linked sub-views, it might return other values.
@@ -908,6 +1320,8 @@

Content manipulation methods

and end line numbers are given, the range from start up to (not including) end, and call f for each line, passing the line handle. + eachLine stops iterating if f returns + truthy value. This is a faster way to visit a range of line handlers than calling getLineHandle for each of them. Note that line handles have @@ -922,10 +1336,14 @@

Content manipulation methods

of changeGeneration, which allows multiple subsystems to track different notions of cleanness without interfering. -
doc.changeGeneration() → integer
+
doc.changeGeneration(?closeEvent: boolean) → integer
Returns a number that can later be passed to isClean to test whether - any edits were made (and not undone) in the meantime.
+ any edits were made (and not undone) in the meantime. + If closeEvent is true, the current history event + will be ‘closed’, meaning it can't be combined with further + changes (rapid typing or deleting events are typically + combined).
doc.isClean(?generation: integer) → boolean
Returns whether the document is currently clean — not modified since initialization or the last call @@ -938,56 +1356,129 @@

Content manipulation methods

Cursor and selection methods

-
doc.getSelection() → string
-
Get the currently selected code.
-
doc.replaceSelection(replacement: string, ?collapse: string)
-
Replace the selection with the given string. By default, the - new selection will span the inserted text. The - optional collapse argument can be used to change - this—passing "start" or "end" will - collapse the selection to the start or end of the inserted - text.
+
doc.getSelection(?lineSep: string) → string
+
Get the currently selected code. Optionally pass a line + separator to put between the lines in the output. When multiple + selections are present, they are concatenated with instances + of lineSep in between.
+
doc.getSelections(?lineSep: string) → array<string>
+
Returns an array containing a string for each selection, + representing the content of the selections.
+ +
doc.replaceSelection(replacement: string, ?select: string)
+
Replace the selection(s) with the given string. By default, + the new selection ends up after the inserted text. The + optional select argument can be used to change + this—passing "around" will cause the new text to be + selected, passing "start" will collapse the + selection to the start of the inserted text.
+
doc.replaceSelections(replacements: array<string>, ?select: string)
+
The length of the given array should be the same as the + number of active selections. Replaces the content of the + selections with the strings in the array. + The select argument works the same as + in replaceSelection.
doc.getCursor(?start: string) → {line, ch}
-
start is a an optional string indicating which - end of the selection to return. It may - be "start", "end", "head" +
Retrieve one end of the primary + selection. start is an optional string indicating + which end of the selection to return. It may + be "from", "to", "head" (the side of the selection that moves when you press shift+arrow), or "anchor" (the fixed side of the selection). Omitting the argument is the same as passing "head". A {line, ch} object will be returned.
+
doc.listSelections() → array<{anchor, head}>
+
Retrieves a list of all current selections. These will + always be sorted, and never overlap (overlapping selections are + merged). Each object in the array contains anchor + and head properties referring to {line, + ch} objects.
+
doc.somethingSelected() → boolean
Return true if any text is selected.
-
doc.setCursor(pos: {line, ch})
+
doc.setCursor(pos: {line, ch}|number, ?ch: number, ?options: object)
Set the cursor position. You can either pass a single {line, ch} object, or the line and the - character as two separate parameters.
-
doc.setSelection(anchor: {line, ch}, ?head: {line, ch})
-
Set the selection range. anchor + character as two separate parameters. Will replace all + selections with a single, empty selection at the given position. + The supported options are the same as for setSelection.
+ +
doc.setSelection(anchor: {line, ch}, ?head: {line, ch}, ?options: object)
+
Set a single selection range. anchor and head should be {line, ch} objects. head defaults to anchor when - not given.
-
doc.extendSelection(from: {line, ch}, ?to: {line, ch})
+ not given. These options are supported: +
+
scroll: boolean
+
Determines whether the selection head should be scrolled + into view. Defaults to true.
+
origin: string
+
Determines whether the selection history event may be + merged with the previous one. When an origin starts with the + character +, and the last recorded selection had + the same origin and was similar (close + in time, both + collapsed or both non-collapsed), the new one will replace the + old one. When it starts with *, it will always + replace the previous event (if that had the same origin). + Built-in motion uses the "+move" origin. User input uses the "+input" origin.
+
bias: number
+
Determine the direction into which the selection endpoints + should be adjusted when they fall inside + an atomic range. Can be either -1 + (backward) or 1 (forward). When not given, the bias will be + based on the relative position of the old selection—the editor + will try to move further away from that, to prevent getting + stuck.
+
+ +
doc.setSelections(ranges: array<{anchor, ?head}>, ?primary: integer, ?options: object)
+
Sets a new set of selections. There must be at least one + selection in the given array. When primary is a + number, it determines which selection is the primary one. When + it is not given, the primary index is taken from the previous + selection, or set to the last range if the previous selection + had less ranges than the new one. Supports the same options + as setSelection. + head defaults to anchor when not given.
+
doc.addSelection(anchor: {line, ch}, ?head: {line, ch})
+
Adds a new selection to the existing set of selections, and + makes it the primary selection.
+ +
doc.extendSelection(from: {line, ch}, ?to: {line, ch}, ?options: object)
Similar to setSelection, but will, if shift is held or the extending flag is set, move the head of the selection while leaving the anchor at its current - place. to is optional, and can be passed to - ensure a region (for example a word or paragraph) will end up - selected (in addition to whatever lies between that region and - the current anchor).
+ place. to is optional, and can be passed to ensure + a region (for example a word or paragraph) will end up selected + (in addition to whatever lies between that region and the + current anchor). When multiple selections are present, all but + the primary selection will be dropped by this method. + Supports the same options as setSelection. +
doc.extendSelections(heads: array<{line, ch}>, ?options: object)
+
An equivalent + of extendSelection + that acts on all selections at once.
+
doc.extendSelectionsBy(f: function(range: {anchor, head}) → {line, ch}), ?options: object)
+
Applies the given function to all existing selections, and + calls extendSelections + on the result.
doc.setExtending(value: boolean)
Sets or clears the 'extending' flag, which acts similar to the shift key, in that it will cause cursor movement and calls to extendSelection to leave the selection anchor in place.
+
doc.getExtending() → boolean
+
Get the value of the 'extending' flag.
cm.hasFocus() → boolean
Tells you whether the editor currently has focus.
-
cm.findPosH(start: {line, ch}, amount: integer, unit: string, visually: boolean) → {line, ch, ?hitSide: boolean}
+
cm.findPosH(start: {line, ch}, amount: integer, unit: string, visually: boolean) → {line, ch, ?hitSide: boolean}
Used to find the target position for horizontal cursor motion. start is a {line, ch} object, amount an integer (may be negative), @@ -1006,6 +1497,10 @@

Cursor and selection methods

be "line" or "page". The other arguments and the returned value have the same interpretation as they have in findPosH.
+ +
cm.findWordAt(pos: {line, ch}) → {anchor: {line, ch}, head: {line, ch}}
+
Returns the start and end of the 'word' (the stretch of + letters, whitespace, or punctuation) at the given position.

Configuration methods

@@ -1021,7 +1516,7 @@

Configuration methods

editor instance.
cm.addKeyMap(map: object, bottom: boolean)
-
Attach an additional keymap to the +
Attach an additional key map to the editor. This is mostly useful for addons that need to register some key handlers without trampling on the extraKeys @@ -1030,14 +1525,14 @@

Configuration methods

and keyMap options, and between them, the maps added earlier have a lower precedence than those added later, unless the bottom argument - was passed, in which case they end up below other keymaps added + was passed, in which case they end up below other key maps added with this method.
cm.removeKeyMap(map: object)
Disable a keymap added with addKeyMap. Either - pass in the keymap object itself, or a string, which will be + pass in the key map object itself, or a string, which will be compared against the name property of the active - keymaps.
+ key maps.
cm.addOverlay(mode: string|object, ?options: object)
Enable a highlighting overlay. This is a stateless mini-mode @@ -1048,15 +1543,25 @@

Configuration methods

spec or a mode object (an object with a token method). The options parameter is optional. If given, it - should be an object. Currently, only the opaque - option is recognized. This defaults to off, but can be given to - allow the overlay styling, when not null, to - override the styling of the base mode entirely, instead of the - two being applied together.
+ should be an object, optionally containing the following options: +
+
opaque: bool
+
Defaults to off, but can be given to allow the overlay + styling, when not null, to override the styling of + the base mode entirely, instead of the two being applied + together.
+
priority: number
+
Determines the ordering in which the overlays are + applied. Those with high priority are applied after those + with lower priority, and able to override the opaqueness of + the ones that come before. Defaults to 0.
+
+ +
cm.removeOverlay(mode: string|object)
Pass this the exact value passed for the mode parameter to addOverlay, - or a string that corresponds to the name propery of + or a string that corresponds to the name property of that value, to remove an overlay again.
cm.on(type: string, func: (...args))
@@ -1077,10 +1582,11 @@

Document management methods

represents the editor content, plus a selection, an undo history, and a mode. A document can only be associated with a single editor at a time. You can create new - documents by calling the CodeMirror.Doc(text, mode, - firstLineNumber) constructor. The last two arguments are - optional and can be used to set a mode for the document and make - it start at a line number other than 0, respectively.

+ documents by calling the CodeMirror.Doc(text: string, mode: + Object, firstLineNumber: ?number, lineSeparator: ?string) + constructor. The last three arguments are optional and can be used + to set a mode for the document, make it start at a line number + other than 0, and set a specific line separator respectively.

cm.getDoc() → Doc
@@ -1142,6 +1648,11 @@

History-related methods

doc.redo()
Redo one undone edit.
+
doc.undoSelection()
+
Undo one edit or selection change.
+
doc.redoSelection()
+
Redo one undone edit or selection change.
+
doc.historySize() → {undo: integer, redo: integer}
Returns an object with {undo, redo} properties, both of which hold integers, indicating the amount of stored @@ -1149,7 +1660,7 @@

History-related methods

doc.clearHistory()
Clears the editor's undo history.
doc.getHistory() → object
-
Get a (JSON-serializeable) representation of the undo history.
+
Get a (JSON-serializable) representation of the undo history.
doc.setHistory(history: object)
Replace the editor's undo history with the one provided, which must be a value as returned @@ -1178,13 +1689,21 @@

Text-marking methods

inclusiveRight: boolean
Like inclusiveLeft, but for the right side.
+
selectLeft: boolean
+
For atomic ranges, determines whether the cursor is allowed + to be placed directly to the left of the range. Has no effect on + non-atomic ranges.
+
selectRight: boolean
+
Like selectLeft, + but for the right side.
atomic: boolean
Atomic ranges act as a single unit when cursor movement is concerned—i.e. it is impossible to place the cursor inside of - them. In atomic ranges, inclusiveLeft - and inclusiveRight have a different meaning—they - will prevent the cursor from being placed respectively - directly before and directly after the range.
+ them. You can control whether the cursor is allowed to be placed + directly before or after them using selectLeft + or selectRight. If selectLeft + (or right) is not provided, then inclusiveLeft (or + right) will control this behavior.
collapsed: boolean
Collapsed ranges do not show up in the display. Setting a range to be collapsed will automatically make it atomic.
@@ -1196,6 +1715,9 @@

Text-marking methods

"clear" event fired on the range handle can be used to be notified when this happens. +
clearWhenEmpty: boolean
+
Determines whether the mark is automatically cleared when + it becomes empty. Default is true.
replacedWith: Element
Use a given node to display this range. Implies both collapsed and atomic. The given DOM node must be an @@ -1224,10 +1746,12 @@

Text-marking methods

is part of the marker.
endStyle: string
Equivalent to startStyle, but for the rightmost span.
-
title: - string
When given, will give the nodes created - for this span a HTML title attribute with the - given value.
+
css: string
+
A string of CSS to be applied to the covered text. For example "color: #fe3".
+
attributes: object
+
When given, add the attributes in the given object to the + elements created for the marked text. Adding class or + style attributes this way is not supported.
shared: boolean
When the target document is linked to other documents, you can set shared to true to make the @@ -1235,7 +1759,7 @@

Text-marking methods

only in its target document.
The method will return an object that represents the marker - (with constuctor CodeMirror.TextMarker), which + (with constructor CodeMirror.TextMarker), which exposes three methods: clear(), to remove the mark, find(), which returns @@ -1260,13 +1784,24 @@

Text-marking methods

widget: Element
Can be used to display a DOM node at the current location of the bookmark (analogous to the replacedWith - option to markText).
+ option to markText).
insertLeft: boolean
By default, text typed when the cursor is on top of the bookmark will end up to the right of the bookmark. Set this option to true to make it go to the left instead.
+
shared: boolean
See + the corresponding option + to markText.
+
handleMouseEvents: boolean
+
As with markText, + this determines whether mouse events on the widget inserted + for this bookmark are handled by CodeMirror. The default is + false.
+
doc.findMarks(from: {line, ch}, to: {line, ch}) → array<TextMarker>
+
Returns an array of all the bookmarks and marked ranges + found between the given positions (non-inclusive).
doc.findMarksAt(pos: {line, ch}) → array<TextMarker>
Returns an array of all the bookmarks and marked ranges present at the given position.
@@ -1277,7 +1812,7 @@

Text-marking methods

Widget, gutter, and decoration methods

-
cm.setGutterMarker(line: integer|LineHandle, gutterID: string, value: Element) → LineHandle
+
doc.setGutterMarker(line: integer|LineHandle, gutterID: string, value: Element) → LineHandle
Sets the gutter marker for the given gutter (identified by its CSS class, see the gutters option) @@ -1286,22 +1821,23 @@

Widget, gutter, and decoration methods

will be shown in the specified gutter next to the specified line.
-
cm.clearGutter(gutterID: string)
+
doc.clearGutter(gutterID: string)
Remove all gutter markers in the gutter with the given ID.
-
cm.addLineClass(line: integer|LineHandle, where: string, class: string) → LineHandle
+
doc.addLineClass(line: integer|LineHandle, where: string, class: string) → LineHandle
Set a CSS class name for the given line. line can be a number or a line handle. where determines - to which element this class should be applied, can can be one + to which element this class should be applied, can be one of "text" (the text element, which lies in front of the selection), "background" (a background element - that will be behind the selection), or "wrap" (the - wrapper node that wraps all of the line's elements, including - gutter elements). class should be the name of the - class to apply.
+ that will be behind the selection), "gutter" (the + line's gutter space), or "wrap" (the wrapper node + that wraps all of the line's elements, including gutter + elements). class should be the name of the class to + apply. -
cm.removeLineClass(line: integer|LineHandle, where: string, class: string) → LineHandle
+
doc.removeLineClass(line: integer|LineHandle, where: string, class: string) → LineHandle
Remove a CSS class from a line. line can be a line handle or number. where should be one of "text", "background", @@ -1310,7 +1846,7 @@

Widget, gutter, and decoration methods

can be left off to remove all classes for the specified node, or be a string to remove only a specific class.
-
cm.lineInfo(line: integer|LineHandle) → object
+
doc.lineInfo(line: integer|LineHandle) → object
Returns the line number, text content, and marker status of the given line, which can be either a number or a line handle. The returned object has the structure {line, handle, text, @@ -1330,7 +1866,7 @@

Widget, gutter, and decoration methods

widget again, simply use DOM methods (move it somewhere else, or call removeChild on its parent).
-
cm.addLineWidget(line: integer|LineHandle, node: Element, ?options: object) → LineWidget
+
doc.addLineWidget(line: integer|LineHandle, node: Element, ?options: object) → LineWidget
Adds a line widget, an element shown below a line, spanning the whole of the editor's width, and moving the lines below it downwards. line should be either an integer or a @@ -1348,9 +1884,6 @@

Widget, gutter, and decoration methods

above: boolean
Causes the widget to be placed above instead of below the text of the line.
-
showIfHidden: boolean
-
When true, will cause the widget to be rendered even if - the line it is associated with is hidden.
handleMouseEvents: boolean
Determines whether the editor will capture mouse and drag events occurring in this widget. Default is false—the @@ -1362,6 +1895,9 @@

Widget, gutter, and decoration methods

position (zero for the top, N to put it after the Nth other widget). Note that this only has effect once, when the widget is created. +
className: string
+
Add an extra CSS class name to the wrapper element + created for the widget.
Note that the widget node will become a descendant of nodes with CodeMirror-specific CSS classes, and those classes might in some @@ -1382,7 +1918,7 @@

Sizing, scrolling and positioning methods

cm.setSize(width: number|string, height: number|string)
-
Programatically set the size of the editor (overriding the +
Programmatically set the size of the editor (overriding the applicable CSS rules). width and height can be either numbers (interpreted as pixels) or CSS units @@ -1416,9 +1952,12 @@

Sizing, scrolling and positioning methods

If mode is "local", they will be relative to the top-left corner of the editable document. If it is "page" or not given, they are relative to the - top-left corner of the page. where can be a boolean - indicating whether you want the start (true) or the - end (false) of the selection, or, if a {line, + top-left corner of the page. If mode + is "window", the coordinates are relative to the + top-left corner of the currently visible (scrolled) + window. where can be a boolean indicating whether + you want the start (true) or the end + (false) of the selection, or, if a {line, ch} object is given, it specifies the precise position at which you want to measure.
cm.charCoords(pos: {line, ch}, ?mode: string) → {left, right, top, bottom}
@@ -1429,7 +1968,7 @@

Sizing, scrolling and positioning methods

position that the cursor would have when it would sit at that position.
cm.coordsChar(object: {left, top}, ?mode: string) → {line, ch}
-
Given an {left, top} object, returns +
Given an {left, top} object (e.g. coordinates of a mouse event) returns the {line, ch} position that corresponds to it. The optional mode parameter determines relative to what the coordinates are interpreted. It may @@ -1440,13 +1979,16 @@

Sizing, scrolling and positioning methods

height. mode can be one of the same strings that coordsChar accepts.
-
cm.heightAtLine(line: number, ?mode: string) → number
+
cm.heightAtLine(line: integer|LineHandle, ?mode: string, ?includeWidgets: bool) → number
Computes the height of the top of a line, in the coordinate system specified by mode (see coordsChar), which defaults to "page". When a line below the bottom of the document is specified, the returned value is the bottom of - the last line in the document.
+ the last line in the document. By default, the position of the + actual text is returned. If `includeWidgets` is true and the + line has line widgets, the position above the first line widget + is returned.
cm.defaultTextHeight() → number
Returns the line height of the default font for the editor.
cm.defaultCharWidth() → number
@@ -1468,7 +2010,8 @@

Sizing, scrolling and positioning methods

If your code does something to change the size of the editor element (window resizes are already listened for), or unhides it, you should probably follow up by calling this method to - ensure CodeMirror is still looking as intended.
+ ensure CodeMirror is still looking as intended. See also + the autorefresh addon.

Mode, state, and token-related methods

@@ -1485,7 +2028,7 @@

Mode, state, and token-related methods

the mode specification, rather than the resolved, instantiated mode object. -
doc.getModeAt(pos: {line, ch}) → object
+
cm.getModeAt(pos: {line, ch}) → object
Gets the inner mode at a given position. This will return the same as getMode for simple modes, but will return an inner mode for nesting modes @@ -1509,6 +2052,13 @@

Mode, state, and token-related methods

edits were recently made and highlighting has not yet completed.
+
cm.getLineTokens(line: integer, ?precise: boolean) → array<{start, end, string, type, state}>
+
This is similar + to getTokenAt, but + collects all tokens for a given line into an array. It is much + cheaper than repeatedly calling getTokenAt, which + re-parses the part of the line before the token for every call.
+
cm.getTokenTypeAt(pos: {line, ch}) → string
This is a (much) cheaper version of getTokenAt useful for @@ -1517,18 +2067,35 @@

Mode, state, and token-related methods

unstyled tokens, and a string, potentially containing multiple space-separated style names, otherwise.
+
cm.getHelpers(pos: {line, ch}, type: string) → array<helper>
+
Fetch the set of applicable helper values for the given + position. Helpers provide a way to look up functionality + appropriate for a mode. The type argument provides + the helper namespace (see + registerHelper), in + which the values will be looked up. When the mode itself has a + property that corresponds to the type, that + directly determines the keys that are used to look up the helper + values (it may be either a single string, or an array of + strings). Failing that, the mode's helperType + property and finally the mode's name are used.
+
For example, the JavaScript mode has a + property fold containing "brace". When + the brace-fold addon is loaded, that defines a + helper named brace in the fold + namespace. This is then used by + the foldcode addon to + figure out that it can use that folding function to fold + JavaScript code.
+
When any 'global' + helpers are defined for the given namespace, their predicates + are called on the current mode and editor, and all those that + declare they are applicable will also be added to the array that + is returned.
+
cm.getHelper(pos: {line, ch}, type: string) → helper
-
Fetch appropriate helper for the given position. Helpers - provide a way to look up functionality appropriate for a mode. - The type argument provides the helper namespace - (see - also registerHelper), - in which the value will be looked up. The key that is used - depends on the mode active at the given - position. If the mode object contains a property with the same - name as the type argument, that is tried first. - Next, the mode's helperType, if any, is tried. And - finally, the mode's name.
+
Returns the first applicable helper value. + See getHelpers.
cm.getStateAfter(?line: integer, ?precise: boolean) → object
Returns the mode's parser state, if any, at the end of the @@ -1552,6 +2119,17 @@

Miscellaneous methods

lot faster. The return value from this method will be the return value of your function.
+
cm.startOperation()
+
cm.endOperation()
+
In normal circumstances, use the above operation + method. But if you want to buffer operations happening asynchronously, + or that can't all be wrapped in a callback function, you can + call startOperation to tell CodeMirror to start + buffering changes, and endOperation to actually + render all the updates. Be careful: if you use this + API and forget to call endOperation, the editor will + just never update.
+
cm.indentLine(line: integer, ?dir: string|integer)
Adjust the indentation of the given line. The second argument (which defaults to "smart") may be one of: @@ -1571,11 +2149,21 @@

Miscellaneous methods

indentation by the given amount of spaces.
-
cm.toggleOverwrite(?value: bool)
+
cm.toggleOverwrite(?value: boolean)
Switches between overwrite and normal insert mode (when not given an argument), or sets the overwrite mode to a specific state (when given an argument).
+
cm.isReadOnly() → boolean
+
Tells you whether the editor's content can be edited by the + user.
+ +
doc.lineSeparator()
+
Returns the preferred line separator string for this + document, as per the option + by the same name. When that option is null, the + string "\n" is returned.
+
cm.execCommand(name: string)
Runs the command with the given name on the editor.
@@ -1591,8 +2179,16 @@

Miscellaneous methods

cm.focus()
Give the editor focus.
-
cm.getInputField() → TextAreaElement
-
Returns the hidden textarea used to read input.
+
cm.phrase(text: string) → string
+
Allow the given string to be translated with + the phrases + option.
+ +
cm.getInputField() → Element
+
Returns the input field for the editor. Will be a textarea + or an editable div, depending on the value of + the inputStyle + option.
cm.getWrapperElement() → Element
Returns the DOM node that represents the editor, and controls its size. Remove this from your tree to delete an @@ -1617,26 +2213,29 @@

Static properties

else (usually one) for dev snapshots.
CodeMirror.fromTextArea(textArea: TextAreaElement, ?config: object)
-
- The method provides another way to initialize an editor. It - takes a textarea DOM node as first argument and an optional - configuration object as second. It will replace the textarea - with a CodeMirror instance, and wire up the form of that - textarea (if any) to make sure the editor contents are put - into the textarea when the form is submitted. The text in the - textarea will provide the content for the editor. A CodeMirror - instance created this way has three additional methods: -
-
cm.save()
-
Copy the content of the editor into the textarea.
- -
cm.toTextArea()
-
Remove the editor, and restore the original textarea (with - the editor's current content).
- -
cm.getTextArea() → TextAreaElement
-
Returns the textarea that the instance was based on.
-
+
This method provides another way to initialize an editor. It + takes a textarea DOM node as first argument and an optional + configuration object as second. It will replace the textarea + with a CodeMirror instance, and wire up the form of that + textarea (if any) to make sure the editor contents are put into + the textarea when the form is submitted. The text in the + textarea will provide the content for the editor. A CodeMirror + instance created this way has three additional methods: +
+
cm.save()
+
Copy the content of the editor into the textarea.
+ +
cm.toTextArea()
+
Remove the editor, and restore the original textarea (with + the editor's current content). If you dynamically create and + destroy editors made with `fromTextArea`, without destroying + the form they are part of, you should make sure to call + `toTextArea` to remove the editor, or its `"submit"` handler + on the form will cause a memory leak.
+ +
cm.getTextArea() → TextAreaElement
+
Returns the textarea that the instance was based on.
+
CodeMirror.defaults: object
@@ -1653,7 +2252,7 @@

Static properties

created from then on.
CodeMirror.defineDocExtension(name: string, value: any)
-
Like defineExtension, +
Like defineExtension, but the method will be added to the interface for Doc objects instead.
@@ -1666,14 +2265,14 @@

Static properties

through setOption.
CodeMirror.defineInitHook(func: function)
-
If your extention just needs to run some +
If your extension just needs to run some code whenever a CodeMirror instance is initialized, use CodeMirror.defineInitHook. Give it a function as its only argument, and from then on, that function will be called (with the instance as argument) whenever a new CodeMirror instance is initialized.
-
CodeMirror.registerHelper(type: string, name: string, value: helper)
+
CodeMirror.registerHelper(type: string, name: string, value: helper)
Registers a helper value with the given name in the given namespace (type). This is used to define functionality that may be looked up by mode. Will create (if it @@ -1684,9 +2283,20 @@

Static properties

myFoo)
, the value CodeMirror.hint.foo will point to myFoo.
-
CodeMirror.Pos(line: integer, ?ch: integer)
-
A constructor for the {line, ch} objects that - are used to represent positions in editor documents.
+
CodeMirror.registerGlobalHelper(type: string, name: string, predicate: fn(mode, CodeMirror), value: helper)
+
Acts + like registerHelper, + but also registers this helper as 'global', meaning that it will + be included by getHelpers + whenever the given predicate returns true when + called with the local mode and editor.
+ +
CodeMirror.Pos(line: integer, ?ch: integer, ?sticky: string)
+
A constructor for the objects that are used to represent + positions in editor documents. sticky defaults to + null, but can be set to "before" + or "after" to make the position explicitly + associate with the character before or after it.
CodeMirror.changeEnd(change: object) → {line, ch}
Utility function that computes an end position from a change @@ -1695,39 +2305,76 @@

Static properties

various event handlers). The returned position will be the end of the changed range, after the change is applied.
+ +
CodeMirror.countColumn(line: string, index: number, tabSize: number) → number
+
Find the column position at a given string index using a given tabsize.
-

Addons

+

Addons

The addon directory in the distribution contains a number of reusable components that implement extra editor - functionality. In brief, they are:

+ functionality (on top of extension functions + like defineOption, defineExtension, + and registerHelper). In + brief, they are:

dialog/dialog.js
Provides a very simple way to query users for text input. - Adds an openDialog method to - CodeMirror instances, which can be called with an HTML fragment - that provides the prompt (should include an input - tag), and a callback function that is called when text has been - entered. Also adds - an openNotification function that - simply shows an HTML fragment as a notification. Depends - on addon/dialog/dialog.css.
+ Adds the openDialog(template, callback, options) → + closeFunction method to CodeMirror instances, + which can be called with an HTML fragment or a detached DOM + node that provides the prompt (should include an input + or button tag), and a callback function that is called + when the user presses enter. It returns a function closeFunction + which, if called, will close the dialog immediately. + openDialog takes the following options: +
+
closeOnEnter: bool
+
If true, the dialog will be closed when the user presses + enter in the input. Defaults to true.
+
closeOnBlur: bool
+
Determines whether the dialog is closed when it loses focus. Defaults to true.
+
onKeyDown: fn(event: KeyboardEvent, value: string, close: fn()) → bool
+
An event handler that will be called whenever keydown fires in the + dialog's input. If your callback returns true, + the dialog will not do any further processing of the event.
+
onKeyUp: fn(event: KeyboardEvent, value: string, close: fn()) → bool
+
Same as onKeyDown but for the + keyup event.
+
onInput: fn(event: InputEvent, value: string, close: fn()) → bool
+
Same as onKeyDown but for the + input event.
+
onClose: fn(instance):
+
A callback that will be called after the dialog has been closed and + removed from the DOM. No return value.
+
+ +

Also adds an openNotification(template, options) → + closeFunction function that simply shows an HTML + fragment as a notification at the top of the editor. It takes a + single option: duration, the amount of time after + which the notification will be automatically closed. If + duration is zero, the dialog will not be closed automatically.

+ +

Depends on addon/dialog/dialog.css.

search/searchcursor.js
-
Adds the getSearchCursor(query, start, caseFold) → +
Adds the getSearchCursor(query, start, options) → cursor method to CodeMirror instances, which can be used to implement search/replace functionality. query - can be a regular expression or a string (only strings will match - across lines—if they contain newlines). start + can be a regular expression or a string. start provides the starting position of the search. It can be a {line, ch} object, or can be left off to default - to the start of the document. caseFold is only - relevant when matching a string. It will cause the search to be - case-insensitive. A search cursor has the following methods: + to the start of the document. options is an + optional object, which can contain the property `caseFold: + false` to disable case folding when matching a string, or the + property `multiline: disable` to disable multi-line matching for + regular expressions (which may help performance). A search + cursor has the following methods:
findNext() → boolean
findPrevious() → boolean
@@ -1742,7 +2389,7 @@

Addons

to findNext or findPrevious did not return false. They will return {line, ch} objects pointing at the start and end of the match.
-
replace(text: string)
+
replace(text: string, ?origin: string)
Replaces the currently found match with the given text and adjusts the cursor position to reflect the replacement.
@@ -1756,14 +2403,60 @@

Addons

of openDialog when available to make prompting for search queries less ugly. +
search/jump-to-line.js
+
Implements a jumpToLine command and binding Alt-G to it. + Accepts linenumber, +/-linenumber, line:char, + scroll% and :linenumber formats. + This will make use of openDialog + when available to make prompting for line number neater.
Demo available here. + +
search/matchesonscrollbar.js
+
Adds a showMatchesOnScrollbar method to editor + instances, which should be given a query (string or regular + expression), optionally a case-fold flag (only applicable for + strings), and optionally a class name (defaults + to CodeMirror-search-match) as arguments. When + called, matches of the given query will be displayed on the + editor's vertical scrollbar. The method returns an object with + a clear method that can be called to remove the + matches. Depends on + the annotatescrollbar + addon, and + the matchesonscrollbar.css + file provides a default (transparent yellowish) definition of + the CSS class applied to the matches. Note that the matches are + only perfectly aligned if your scrollbar does not have buttons + at the top and bottom. You can use + the simplescrollbar + addon to make sure of this. If this addon is loaded, + the search addon will + automatically use it.
+
edit/matchbrackets.js
Defines an option matchBrackets which, when set - to true, causes matching brackets to be highlighted whenever the - cursor is next to them. It also adds a + to true or an options object, causes matching brackets to be + highlighted whenever the cursor is next to them. It also adds a method matchBrackets that forces this to happen once, and a method findMatchingBracket that can be used to run the bracket-finding algorithm that this uses - internally.
+ internally. It takes a start position and an optional config + object. By default, it will find the match to a matchable + character either before or after the cursor (preferring the one + before), but you can control its behavior with these options: +
+
afterCursor
+
Only use the character after the start position, never the one before it.
+
highlightNonMatching
+
Also highlight pairs of non-matching as well as stray brackets. Enabled by default.
+
strict
+
Causes only matches where both brackets are at the same side of the start position to be considered.
+
maxScanLines
+
Stop after scanning this amount of lines without a successful match. Defaults to 1000.
+
maxScanLineLength
+
Ignore lines longer than this. Defaults to 10000.
+
maxHighlightLineLength
+
Don't highlight a bracket in a line longer than this. Defaults to 1000.
+
edit/closebrackets.js
Defines an option autoCloseBrackets that will @@ -1775,7 +2468,13 @@

Addons

it. explode should be a similar string that gives the pairs of characters that, when enter is pressed between them, should have the second character also moved to its own - line. Demo here.
+ line. By default, if the active mode has + a closeBrackets property, that overrides the + configuration given in the option. But you can add + an override property with a truthy value to + override mode-specific + configuration. Demo + here.
edit/matchtags.js
Defines an option matchTags that, when enabled, @@ -1783,7 +2482,7 @@

Addons

the CodeMirror-matchingtag class). Also defines a command toMatchingTag, - which you can bind a key to in order to jump to the tag mathing + which you can bind a key to in order to jump to the tag matching the one under the cursor. Depends on the addon/fold/xml-fold.js addon. Demo here.
@@ -1796,22 +2495,29 @@

Addons

squiggly underline style for this class.
edit/closetag.js
-
Provides utility functions for adding automatic tag closing - to XML modes. See +
Defines an autoCloseTags option that will + auto-close XML tags when '>' or '/' + is typed, and + a closeTag command that + closes the nearest open tag. Depends on + the fold/xml-fold.js addon. See the demo.
edit/continuelist.js
Markdown specific. Defines a "newlineAndIndentContinueMarkdownList" command - command that can be bound to enter to automatically + that can be bound to enter to automatically insert the leading characters for continuing a list. See the Markdown mode demo.
comment/comment.js
-
Addon for commenting and uncommenting code. Adds three +
Addon for commenting and uncommenting code. Adds four methods to CodeMirror instances:
+
toggleComment(?options: object)
+
Tries to uncomment the current selection, and if that + fails, line-comments it.
lineComment(from: {line, ch}, to: {line, ch}, ?options: object)
Set the lines in the given range to be line comments. Will fall back to blockComment when no line comment @@ -1832,8 +2538,9 @@

Addons

Override the comment string properties of the mode with custom comment strings.
padding: string
-
A string that will be inserted after opening and before - closing comment markers. Defaults to a single space.
+
A string that will be inserted after opening and leading + markers, and before closing comment markers. Defaults to a + single space.
commentBlankLines: boolean
Whether, when adding line comments, to also comment lines that contain only whitespace.
@@ -1848,8 +2555,8 @@

Addons

The addon also defines a toggleComment command, - which will try to uncomment the current selection, and if that - fails, line-comments it.
+ which is a shorthand command for calling + toggleComment with no options.
fold/foldcode.js
Helps with code folding. Adds a foldCode method @@ -1862,11 +2569,12 @@

Addons

supporting the following properties:
rangeFinder: fn(CodeMirror, Pos)
-
The function that is used to find foldable ranges. If this - is not directly passed, it will - call getHelper with - a "fold" type to find one that's appropriate for - the mode. There are files in +
The function that is used to find + foldable ranges. If this is not directly passed, it will + default to CodeMirror.fold.auto, which + uses getHelpers with + a "fold" type to find folding functions + appropriate for the local mode. There are files in the addon/fold/ directory providing CodeMirror.fold.brace, which finds blocks in brace languages (JavaScript, C, Java, @@ -1875,10 +2583,14 @@

Addons

and CodeMirror.fold.xml, for XML-style languages, and CodeMirror.fold.comment, for folding comment blocks.
-
widget: string|Element
+
widget: string | Element | fn(from: Pos, to: Pos) → string|Element
The widget to show for folded ranges. Can be either a string, in which case it'll become a span with - class CodeMirror-foldmarker, or a DOM node.
+ class CodeMirror-foldmarker, or a DOM node. + To dynamically generate the widget, this can be a function + that returns a string or DOM node, which will then render + as described. The function will be invoked with parameters + identifying the range to be folded.
scanUp: boolean
When true (default is false), the addon will try to find foldable ranges on the lines above the current one if there @@ -1925,20 +2637,22 @@

Addons

rangeFinder: fn(CodeMirror, Pos)
The range-finder function to use when determining whether something can be folded. When not - given, getHelper will be - used to determine a default.
+ given, CodeMirror.fold.auto + will be used as default.
+ The foldOptions editor option can be set to an + object to provide an editor-wide default configuration. Demo here.
runmode/runmode.js
Can be used to run a CodeMirror mode over text without actually opening an editor instance. See the demo for an example. - There are alternate versions of the file avaible for + There are alternate versions of the file available for running stand-alone (without including all of CodeMirror) and for running under - node.js.
+ node.js (see bin/source-highlight for an example of using the latter).
runmode/colorize.js
Provides a convenient way to syntax-highlight code snippets @@ -1970,7 +2684,7 @@

Addons

between several modes. Defines CodeMirror.multiplexingMode which, when given as first argument a mode object, and as other arguments - any number of {open, close, mode [, delimStyle, innerStyle]} + any number of {open, close, mode [, delimStyle, innerStyle, parseDelimiters]} objects, will return a mode object that starts parsing using the mode passed as first argument, but will switch to another mode as soon as it encounters a string that occurs in one of @@ -1980,29 +2694,43 @@

Addons

Pass "\n" for open or close if you want to switch on a blank line.
  • When delimStyle is specified, it will be the token - style returned for the delimiter tokens.
  • + style returned for the delimiter tokens (as well as + [delimStyle]-open on the opening token and + [delimStyle]-close on the closing token).
  • When innerStyle is specified, it will be the token - style added for each inner mode token.
- The outer mode will not see the content between the delimiters. + style added for each inner mode token. +
  • When parseDelimiters is true, the content of + the delimiters will also be passed to the inner mode. + (And delimStyle is ignored.)
  • The outer + mode will not see the content between the delimiters. See this demo for an example.
    hint/show-hint.js
    Provides a framework for showing autocompletion hints. - Defines CodeMirror.showHint, which takes a - CodeMirror instance, a hinting function, and optionally an + Defines editor.showHint, which takes an optional options object, and pops up a widget that allows the user to - select a completion. Hinting functions are function that take an - editor instance and an optional options object, and return + select a completion. Finding hints is done with a hinting + function (the hint option). This function + takes an editor instance and an options object, and returns a {list, from, to} object, where list is an array of strings or objects (the completions), and from and to give the start and end of the token that is being completed as {line, ch} - objects. If no hinting function is given, the addon will try to - use getHelper with - the "hint" type to find one. When completions - aren't simple strings, they should be objects with the folowing - properties: + objects. An optional selectedHint property (an + integer) can be added to the completion object to control the + initially selected hint.
    +
    If no hinting function is given, the addon will + use CodeMirror.hint.auto, which + calls getHelpers with + the "hint" type to find applicable hinting + functions, and tries them one by one. If that fails, it looks + for a "hintWords" helper to fetch a list of + completeable words for the mode, and + uses CodeMirror.hint.fromList to complete from + those.
    +
    When completions aren't simple strings, they should be + objects with the following properties:
    text: string
    The completion text. This is the only required @@ -2018,17 +2746,35 @@

    Addons

    hint: fn(CodeMirror, self, data)
    A method used to actually apply the completion, instead of the default behavior.
    -
    - The plugin understands the following options (the options object - will also be passed along to the hinting function, which may - understand additional options): +
    from: {line, ch}
    +
    Optional from position that will be used by pick() instead + of the global one passed with the full list of completions.
    +
    to: {line, ch}
    +
    Optional to position that will be used by pick() instead + of the global one passed with the full list of completions.
    + + +
    The plugin understands the following options, which may be + either passed directly in the argument to showHint, + or provided by setting an hintOptions editor + option to an object (the former takes precedence). The options + object will also be passed along to the hinting function, which + may understand additional options.
    -
    async: boolean
    -
    When set to true, the hinting function's signature should - be (cm, callback, ?options), and the completion - interface will only be popped up when the hinting function - calls the callback, passing it the object holding the - completions.
    +
    hint: function
    +
    A hinting function, as specified above. It is possible to + set the async property on a hinting function to + true, in which case it will be called with + arguments (cm, callback, ?options), and the + completion interface will only be popped up when the hinting + function calls the callback, passing it the object holding the + completions. + The hinting function can also return a promise, and the completion + interface will only be popped when the promise resolves. + By default, hinting only works when there is no + selection. You can give a hinting function + a supportsSelection property with a truthy value + to indicate that it supports selections.
    completeSingle: boolean
    Determines whether, when only a single completion is available, it is completed without showing the dialog. @@ -2036,21 +2782,41 @@

    Addons

    alignWithWord: boolean
    Whether the pop-up should be horizontally aligned with the start of the word (true, default), or with the cursor (false).
    +
    closeCharacters: RegExp
    +
    A regular expression object used to match characters which + cause the pop up to be closed (default: /[\s()\[\]{};:>,]/). + If the user types one of these characters, the pop up will close, and + the endCompletion event is fired on the editor instance.
    closeOnUnfocus: boolean
    When enabled (which is the default), the pop-up will close when the editor is unfocused.
    +
    completeOnSingleClick: boolean
    +
    Whether a single click on a list item suffices to trigger the + completion (which is the default), or if the user has to use a + doubleclick.
    +
    container: Element|null
    +
    Can be used to define a custom container for the widget. The default + is null, in which case the body-element will + be used.
    customKeys: keymap
    -
    Allows you to provide a custom keymap of keys to be active +
    Allows you to provide a custom key map of keys to be active when the pop-up is active. The handlers will be called with an extra argument, a handle to the completion menu, which has moveFocus(n), setFocus(n), pick(), and close() methods (see the source for details), that can be used to change the focused element, pick the - current element or close the menu.
    + current element or close the menu. Additionally menuSize() + can give you access to the size of the current dropdown menu, + length give you the number of available completions, and + data give you full access to the completion returned by the + hinting function.
    extraKeys: keymap
    Like customKeys above, but the bindings will be added to the set of default bindings, instead of replacing them.
    +
    scrollMargin: integer
    +
    Show this many lines before and after the selected item. + Default is 0.
    The following events will be fired on the completions object during completion: @@ -2061,10 +2827,21 @@

    Addons

    Fired when a completion is selected. Passed the completion value (string or object) and the DOM node that represents it in the menu.
    +
    "pick" (completion)
    +
    Fired when a completion is picked. Passed the completion value + (string or object).
    "close" ()
    Fired when the completion is finished.
    - This addon depends styles + The following events will be fired on the editor instance during + completion: +
    +
    "endCompletion" ()
    +
    Fired when the pop-up is being closed programmatically, e.g., when + the user types a character which matches the + closeCharacters option.
    +
    + This addon depends on styles from addon/hint/show-hint.css. Check out the demo for an example. @@ -2091,8 +2868,13 @@

    Addons

    and attrs (an object mapping attribute names to null for free-form attributes, and an array of valid values for restricted - attributes). Demo - here. + attributes).
    The hint options accept an additional property: +
    +
    matchInMiddle: boolean
    +
    Determines whether typed characters are matched anywhere in + completions, not just at the beginning. Defaults to false.
    +
    + Demo here.
    hint/html-hint.js
    Provides schema info to @@ -2106,13 +2888,9 @@

    Addons

    the demo.
    hint/css-hint.js
    -
    A minimal hinting function for CSS code. +
    A hinting function for CSS, SCSS, or LESS code. Defines CodeMirror.hint.css.
    -
    hint/python-hint.js
    -
    A very simple hinting function for Python code. - Defines CodeMirror.hint.python.
    -
    hint/anyword-hint.js
    A very simple hinting function (CodeMirror.hint.anyword) that simply looks for @@ -2123,10 +2901,11 @@

    Addons

    should scan when completing (defaults to 500).
    hint/sql-hint.js
    -
    A simple SQL hinter. Defines CodeMirror.hint.sql.
    - -
    hint/pig-hint.js
    -
    A simple hinter for Pig Latin. Defines CodeMirror.hint.pig.
    +
    A simple SQL hinter. Defines CodeMirror.hint.sql. + Takes two optional options, tables, a object with + table names as keys and array of respective column names as values, + and defaultTable, a string corresponding to a + table name in tables for autocompletion.
    search/match-highlighter.js
    Adds a highlightSelectionMatches option that @@ -2137,7 +2916,8 @@

    Addons

    (default 2), style, for the style to be used to highlight the matches (default "matchhighlight", which will correspond to CSS - class cm-matchhighlight), + class cm-matchhighlight), trim, which + controls whether whitespace is trimmed from the selection, and showToken which can be set to true or to a regexp matching the characters that make up a word. When enabled, it causes the current word to be highlighted when @@ -2147,17 +2927,34 @@

    Addons

    lint/lint.js
    Defines an interface component for showing linting warnings, with pluggable warning sources - (see json-lint.js, + (see html-lint.js, + json-lint.js, javascript-lint.js, + coffeescript-lint.js, and css-lint.js in the same directory). Defines a lint option that - can be set to a warning source (for - example CodeMirror.lint.javascript), or - to true, in which - case getHelper with - type "lint" is used to determined a validator - function. Depends on addon/lint/lint.css. A demo - can be found here.
    + can be set to an annotation source (for + example CodeMirror.lint.javascript), to an options + object (in which case the getAnnotations field is + used as annotation source), or simply to true. When + no annotation source is + specified, getHelper with + type "lint" is used to find an annotation function. + An annotation source function should, when given a document + string, an options object, and an editor instance, return an + array of {message, severity, from, to} objects + representing problems. When the function has + an async property with a truthy value, it will be + called with an additional second argument, which is a callback + to pass the array to. + The linting function can also return a promise, in that case the linter + will only be executed when the promise resolves. + By default, the linter will run (debounced) whenever the document is changed. + You can pass a lintOnChange: false option to disable that. + You can pass a selfContain: true option to render the tooltip inside the editor instance. + And a highlightLines option to add a style to lines that contain problems. + Depends on addon/lint/lint.css. A demo can be + found here.
    selection/mark-selection.js
    Causes the selected text to be marked with the CSS class @@ -2166,36 +2963,86 @@

    Addons

    like in this demo.
    selection/active-line.js
    -
    Defines a styleActiveLine option that, when enabled, - gives the wrapper of the active line the class CodeMirror-activeline, - and adds a background with the class CodeMirror-activeline-background. - is enabled. See the demo.
    +
    Defines a styleActiveLine option that, when + enabled, gives the wrapper of the line that contains the cursor + the class CodeMirror-activeline, adds a background + with the class CodeMirror-activeline-background, + and adds the class CodeMirror-activeline-gutter to + the line's gutter space is enabled. The option's value may be a + boolean or an object specifying the following options: +
    +
    nonEmpty: bool
    +
    Controls whether single-line selections, or just cursor + selections, are styled. Defaults to false (only cursor + selections).
    +
    + See the demo.
    + +
    selection/selection-pointer.js
    +
    Defines a selectionPointer option which you can + use to control the mouse cursor appearance when hovering over + the selection. It can be set to a string, + like "pointer", or to true, in which case + the "default" (arrow) cursor will be used. You can + see a demo here.
    mode/loadmode.js
    -
    Defines a CodeMirror.requireMode(modename, - callback) function that will try to load a given mode and - call the callback when it succeeded. You'll have to - set CodeMirror.modeURL to a string that mode paths - can be constructed from, for - example "mode/%N/%N.js"—the %N's will - be replaced with the mode name. Also +
    Defines a CodeMirror.requireMode(modename, callback, + options) function that will try to load a given mode and + call the callback when it succeeded. options is an + optional object that may contain: +
    +
    path: fn(modeName: string) → string
    +
    Defines the way mode names are mapped to paths.
    +
    loadMode: fn(path: string, cont: fn())
    +
    Override the way the mode script is loaded. By default, + this will use the CommonJS or AMD module loader if one is + present, and fall back to creating + a <script> tag otherwise.
    +
    + This addon also defines CodeMirror.autoLoadMode(instance, mode), which will ensure the given mode is loaded and cause the given editor instance to refresh its mode when the loading succeeded. See the demo.
    +
    mode/meta.js
    +
    Provides meta-information about all the modes in the + distribution in a single file. + Defines CodeMirror.modeInfo, an array of objects + with {name, mime, mode} properties, + where name is the human-readable + name, mime the MIME type, and mode the + name of the mode file that defines this MIME. There are optional + properties mimes, which holds an array of MIME + types for modes with multiple MIMEs associated, + and ext, which holds an array of file extensions + associated with this mode. Four convenience + functions, CodeMirror.findModeByMIME, + CodeMirror.findModeByExtension, + CodeMirror.findModeByFileName + and CodeMirror.findModeByName are provided, which + return such an object given a MIME, extension, file name or mode name + string. Note that, for historical reasons, this file resides in the + top-level mode directory, not + under addon. Demo.
    +
    comment/continuecomment.js
    -
    Adds an continueComments option, which can be - set to true to have the editor prefix new lines inside C-like - block comments with an asterisk when Enter is pressed. It can - also be set to a string in order to bind this functionality to a - specific key..
    +
    Adds a continueComments option, which sets whether the + editor will make the next line continue a comment when you press Enter + inside a comment block. Can be set to a boolean to enable/disable this + functionality. Set to a string, it will continue comments using a custom + shortcut. Set to an object, it will use the key property for + a custom shortcut and the boolean continueLineComment + property to determine whether single-line comments should be continued + (defaulting to true).
    display/placeholder.js
    Adds a placeholder option that can be used to - make text appear in the editor when it is empty and not focused. - Also gives the editor a CodeMirror-empty CSS class - whenever it doesn't contain any text. + make content appear in the editor when it is empty and not + focused. It can hold either a string or a DOM node. Also gives + the editor a CodeMirror-empty CSS class whenever it + doesn't contain any text. See the demo.
    display/fullscreen.js
    @@ -2205,6 +3052,96 @@

    Addons

    on fullscreen.css. Demo here. +
    display/autorefresh.js
    +
    This addon can be useful when initializing an editor in a + hidden DOM node, in cases where it is difficult to + call refresh when the editor + becomes visible. It defines an option autoRefresh + which you can set to true to ensure that, if the editor wasn't + visible on initialization, it will be refreshed the first time + it becomes visible. This is done by polling every 250 + milliseconds (you can pass a value like {delay: + 500} as the option value to configure this). Note that + this addon will only refresh the editor once when it + first becomes visible, and won't take care of further restyling + and resizing.
    + +
    scroll/simplescrollbars.js
    +
    Defines two additional scrollbar + models, "simple" and "overlay" + (see demo) that can + be selected with + the scrollbarStyle + option. Depends + on simplescrollbars.css, + which can be further overridden to style your own + scrollbars.
    + +
    scroll/annotatescrollbar.js
    +
    Provides functionality for showing markers on the scrollbar + to call out certain parts of the document. Adds a + method annotateScrollbar to editor instances that + can be called, with a CSS class name as argument, to create a + set of annotations. The method returns an object + whose update method can be called with a sorted array + of {from: Pos, to: Pos} objects marking the ranges + to be highlighted. To detach the annotations, call the + object's clear method.
    + +
    display/rulers.js
    +
    Adds a rulers option, which can be used to show + one or more vertical rulers in the editor. The option, if + defined, should be given an array of {column [, className, + color, lineStyle, width]} objects or numbers (which + indicate a column). The ruler will be displayed at the column + indicated by the number or the column property. + The className property can be used to assign a + custom style to a ruler. Demo + here.
    + +
    display/panel.js
    +
    Defines an addPanel method for CodeMirror + instances, which places a DOM node above or below an editor, and + shrinks the editor to make room for the node. The method takes + as first argument as DOM node, and as second an optional options + object. The Panel object returned by this method + has a clear method that is used to remove the + panel, and a changed method that can be used to + notify the addon when the size of the panel's DOM node has + changed.
    + The method accepts the following options: +
    +
    position: string
    +
    Controls the position of the newly added panel. The + following values are recognized: +
    +
    top (default)
    +
    Adds the panel at the very top.
    +
    after-top
    +
    Adds the panel at the bottom of the top panels.
    +
    bottom
    +
    Adds the panel at the very bottom.
    +
    before-bottom
    +
    Adds the panel at the top of the bottom panels.
    +
    +
    +
    before: Panel
    +
    The new panel will be added before the given panel.
    +
    after: Panel
    +
    The new panel will be added after the given panel.
    +
    replace: Panel
    +
    The new panel will replace the given panel.
    +
    stable: bool
    +
    Whether to scroll the editor to keep the text's vertical + position stable, when adding a panel above it. Defaults to false.
    +
    + When using the after, before or replace options, + if the panel doesn't exists or has been removed, + the value of the position option will be used as a fallback. +
    + A demo of the addon is available here. +
    +
    wrap/hardwrap.js
    Addon to perform hard line wrapping/breaking for paragraphs of text. Adds these methods to editor instances: @@ -2216,7 +3153,7 @@

    Addons

    wrapRange(from: {line, ch}, to: {line, ch}, ?options: object)
    Wraps the given range as one big paragraph.
    wrapParagraphsInRange(from: {line, ch}, to: {line, ch}, ?options: object)
    -
    Wrapps the paragraphs in (and overlapping with) the +
    Wraps the paragraphs in (and overlapping with) the given range individually.
    The following options are recognized: @@ -2234,34 +3171,80 @@

    Addons

    killTrailingSpace: boolean
    Whether trailing space caused by wrapping should be preserved, or deleted. Defaults to true.
    +
    forceBreak: boolean
    +
    If set to true forces a break at column in the case + when no wrapOn pattern is found in the range. If set to + false allows line to overflow the column limit if no + wrapOn pattern found. Defaults to true.
    A demo of the addon is available here. +
    scroll/scrollpastend.js
    +
    Defines an option `"scrollPastEnd"` that, when set to a + truthy value, allows the user to scroll one editor height of + empty space into view at the bottom of the editor.
    +
    merge/merge.js
    Implements an interface for merging changes, using either a 2-way or a 3-way view. The CodeMirror.MergeView constructor takes arguments similar to the CodeMirror constructor, first a node to append the interface to, and then - an options object. Two extra optional options are - recognized, origLeft and origRight, - which may be strings that provide original versions of the - document, which will be shown to the left and right of the - editor in non-editable CodeMirror instances. The merge interface - will highlight changes between the editable document and the - original(s) (demo).
    + an options object. Options are passed through to the editors + inside the view. These extra options are recognized: +
    +
    origLeft and origRight: string
    +
    If given these provide original versions of the + document, which will be shown to the left and right of the + editor in non-editable CodeMirror instances. The merge + interface will highlight changes between the editable + document and the original(s). To create a 2-way (as opposed + to 3-way) merge view, provide only one of them.
    +
    revertButtons: boolean
    +
    Determines whether buttons that allow the user to revert + changes are shown. Defaults to true.
    +
    revertChunk: fn(mv: MergeView, from: CodeMirror, fromStart: Pos, fromEnd: Pos, to: CodeMirror, toStart: Pos, toEnd: Pos)
    +
    Can be used to define custom behavior when the user + reverts a changed chunk.
    +
    connect: string
    +
    Sets the style used to connect changed chunks of code. + By default, connectors are drawn. When this is set + to "align", the smaller chunk is padded to + align with the bigger chunk instead.
    +
    collapseIdentical: boolean|number
    +
    When true (default is false), stretches of unchanged + text will be collapsed. When a number is given, this + indicates the amount of lines to leave visible around such + stretches (which defaults to 2).
    +
    allowEditingOriginals: boolean
    +
    Determines whether the original editor allows editing. + Defaults to false.
    +
    showDifferences: boolean
    +
    When true (the default), changed pieces of text are + highlighted.
    +
    chunkClassLocation: string|Array
    +
    By default the chunk highlights are added + using addLineClass + with "background". Override this to customize it to be any + valid `where` parameter or an Array of valid `where` + parameters.
    +
    + The addon also defines commands "goNextDiff" + and "goPrevDiff" to quickly jump to the next + changed chunk. Demo + here.
    tern/tern.js
    Provides integration with - the Tern JavaScript analysis + the Tern JavaScript analysis engine, for completion, definition finding, and minor refactoring help. See the demo for a very simple integration. For more involved scenarios, see the comments at the top of the addon and the implementation of the - (multi-file) demonstration + (multi-file) demonstration on the Tern website.
    @@ -2275,6 +3258,11 @@

    Writing CodeMirror Modes

    advances it past a token, and returns a style for that token. More advanced modes can also handle indentation for the language.

    +

    This section describes the low-level mode interface. Many modes + are written directly against this, since it offers a lot of + control, but for a quick mode definition, you might want to use + the simple mode addon.

    +

    The mode script should call CodeMirror.defineMode to register itself with CodeMirror. This function takes two @@ -2346,7 +3334,7 @@

    Writing CodeMirror Modes

    peek() → string
    Returns the next character in the stream without advancing - it. Will return an null at the end of the + it. Will return a null at the end of the line.
    next() → string
    Returns the next character in the stream and advances it. @@ -2367,11 +3355,11 @@

    Writing CodeMirror Modes

    white-space.
    skipToEnd()
    Moves the position to the end of the line.
    -
    skipTo(ch: string) → boolean
    -
    Skips to the next occurrence of the given character, if +
    skipTo(str: string) → boolean
    +
    Skips to the start of the next occurrence of the given string, if found on the current line (doesn't advance the stream if the - character does not occur on the line). Returns true if the - character was found.
    + string does not occur on the line). Returns true if the + string was found.
    match(pattern: string, ?consume: boolean, ?caseFold: boolean) → boolean
    match(pattern: regexp, ?consume: boolean) → array<string>
    Act like a @@ -2399,6 +3387,18 @@

    Writing CodeMirror Modes

    current() → string
    Get the string between the start of the current token and the current stream position.
    + +
    lookAhead(n: number) → ?string
    +
    Get the line n (>0) lines after the current + one, in order to scan ahead across line boundaries. Note that + you want to do this carefully, since looking far ahead will make + mode state caching much less effective.
    + +
    baseToken() → ?{type: ?string, size: number}
    +
    Modes added + through addOverlay + (and only such modes) can use this method to inspect + the current token produced by the underlying mode.

    By default, blank lines are simply skipped when @@ -2447,12 +3447,20 @@

    Writing CodeMirror Modes

    continued lines in a block comment). All of these are optional.

    -

    Finally, a mode may define - an electricChars property, which should hold a string - containing all the characters that should trigger the behaviour - described for +

    Finally, a mode may define either + an electricChars or an electricInput + property, which are used to automatically reindent the line when + certain patterns are typed and the electricChars - option.

    + option is enabled. electricChars may be a string, and + will trigger a reindent whenever one of the characters in that + string are typed. Often, it is more appropriate to + use electricInput, which should hold a regular + expression, and will trigger indentation when the part of the + line before the cursor matches the expression. It should + usually end with a $ character, so that it only + matches when the indentation-changing pattern was just typed, not when something was + typed after the pattern.

    So, to summarize, a mode must provide a token method, and it may @@ -2504,6 +3512,13 @@

    Writing CodeMirror Modes

    object specifying a mode, as in the mode option.

    +

    If a mode specification wants to add some properties to the + resulting mode object, typically for use + with getHelpers, it may + contain a modeProps property, which holds an object. + This object's properties will be copied to the actual mode + object.

    +

    Sometimes, it is useful to add or override mode object properties from external code. The CodeMirror.extendMode function @@ -2514,6 +3529,233 @@

    Writing CodeMirror Modes

    looked up through getMode.

    +
    +

    VIM Mode API

    + +

    CodeMirror has a robust VIM mode that attempts to faithfully + emulate VIM's most useful features. It can be enabled by + including keymap/vim.js + and setting the keyMap option to + "vim".

    + +

    Configuration

    + +

    VIM mode accepts configuration options for customizing + behavior at run time. These methods can be called at any time + and will affect all existing CodeMirror instances unless + specified otherwise. The methods are exposed on the + CodeMirror.Vim object.

    + +
    +
    setOption(name: string, value: any, ?cm: CodeMirror, ?cfg: object)
    +
    Sets the value of a VIM option. name should + be the name of an option. If cfg.scope is not set + and cm is provided, then sets the global and + instance values of the option. Otherwise, sets either the + global or instance value of the option depending on whether + cfg.scope is global or + local.
    +
    getOption(name: string, ?cm: CodeMirror: ?cfg: object)
    +
    Gets the current value of a VIM option. If + cfg.scope is not set and cm is + provided, then gets the instance value of the option, falling + back to the global value if not set. If cfg.scope is provided, then gets the global or + local value without checking the other.
    + +
    map(lhs: string, rhs: string, ?context: string)
    +
    Maps a key sequence to another key sequence. Implements + VIM's :map command. To map ; to : in VIM would be + :map ; :. That would translate to + CodeMirror.Vim.map(';', ':');. + The context can be normal, + visual, or insert, which correspond + to :nmap, :vmap, and + :imap + respectively.
    + +
    mapCommand(keys: string, type: string, name: string, ?args: object, ?extra: object)
    +
    Maps a key sequence to a motion, + operator, or action type command. + The args object is passed through to the command when it is + invoked by the provided key sequence. + extras.context can be normal, + visual, or insert, to map the key + sequence only in the corresponding mode. + extras.isEdit is applicable only to actions, + determining whether it is recorded for replay for the + . single-repeat command. + +
    unmap(lhs: string, ctx: string)
    +
    + Remove the command lhs if it is a user defined command. + If the command is an Ex to Ex or Ex to key mapping then the context + must be undefined or false. +
    + +
    mapclear(ctx: string)
    +
    + Remove all user-defined mappings for the provided context. +
    + +
    noremap(lhs: string, rhs: string, ctx: {string, array<string>})
    +
    + Non-recursive map function. This will not create mappings to key maps + that aren't present in the default key map. + If no context is provided then the mapping will be applied to each of + normal, insert, and visual mode. +
    +
    + +

    Events

    + +

    VIM mode signals a few events on the editor instance. For an example usage, see demo/vim.html#L101.

    + +
    +
    "vim-command-done" (reason: undefined)
    +
    Fired on keypress and mousedown where command has completed or no command found.
    + +
    "vim-keypress" (vimKey: string)
    +
    Fired on keypress, vimKey is in Vim's key notation.
    + +
    "vim-mode-change" (modeObj: object)
    +
    Fired after mode change, modeObj parameter is a {mode: string, ?subMode: string} object. Modes: "insert", "normal", "replace", "visual". Visual sub-modes: "linewise", "blockwise".
    +
    + +

    Extending VIM

    + +

    CodeMirror's VIM mode implements a large subset of VIM's core + editing functionality. But since there's always more to be + desired, there is a set of APIs for extending VIM's + functionality. As with the configuration API, the methods are + exposed on CodeMirror.Vim and may + be called at any time.

    + +
    +
    defineOption(name: string, default: any, type: string, ?aliases: array<string>, ?callback: function (?value: any, ?cm: CodeMirror) → ?any)
    +
    Defines a VIM style option and makes it available to the + :set command. Type can be boolean or + string, used for validation and by + :set to determine which syntax to accept. If a + callback is passed in, VIM does not store the value of the + option itself, but instead uses the callback as a setter/getter. If the + first argument to the callback is undefined, then the + callback should return the value of the option. Otherwise, it should set + instead. Since VIM options have global and instance values, whether a + CodeMirror instance is passed in denotes whether the global + or local value should be used. Consequently, it's possible for the + callback to be called twice for a single setOption or + getOption call. Note that right now, VIM does not support + defining buffer-local options that do not have global values. If an + option should not have a global value, either always ignore the + cm parameter in the callback, or always pass in a + cfg.scope to setOption and + getOption.
    + +
    defineMotion(name: string, fn: function(cm: CodeMirror, head: {line, ch}, ?motionArgs: object}) → {line, ch})
    +
    Defines a motion command for VIM. The motion should return + the desired result position of the cursor. head + is the current position of the cursor. It can differ from + cm.getCursor('head') if VIM is in visual mode. + motionArgs is the object passed into + mapCommand().
    + +
    defineOperator(name: string, fn: function(cm: CodeMirror, ?operatorArgs: object, ranges: array<{anchor, head}>) → ?{line, ch})
    +
    Defines an operator command, similar to + defineMotion. ranges is the range + of text the operator should operate on. If the cursor should + be set to a certain position after the operation finishes, it + can return a cursor object.
    + +
    defineAction(name: string, fn: function(cm: CodeMirror, ?actionArgs: object))
    +
    Defines an action command, similar to + defineMotion. Action commands + can have arbitrary behavior, making them more flexible than + motions and operators, at the loss of orthogonality.
    + +
    defineEx(name: string, ?prefix: string, fn: function(cm: CodeMirror, ?params: object))
    +
    Defines an Ex command, and maps it to :name. + If a prefix is provided, it, and any prefixed substring of the + name beginning with the prefix can + be used to invoke the command. If the prefix is + falsy, then name is used as the prefix. + params.argString contains the part of the prompted + string after the command name. params.args is + params.argString split by whitespace. If the + command was prefixed with a + line range, + params.line and params.lineEnd will + be set.
    + +
    getRegisterController()
    +
    Returns the RegisterController that manages the state of registers + used by vim mode. For the RegisterController api see its + definition here. +
    + +
    buildKeyMap()
    +
    + Not currently implemented. If you would like to contribute this please open + a pull request on GitHub. +
    + +
    defineRegister()
    +
    Defines an external register. The name should be a single character + that will be used to reference the register. The register should support + setText, pushText, clear, and toString. + See Register for a reference implementation. +
    + +
    getVimGlobalState_()
    +
    + Return a reference to the VimGlobalState. +
    + +
    resetVimGlobalState_()
    +
    + Reset the default values of the VimGlobalState to fresh values. Any options + set with setOption will also be applied to the reset global state. +
    + +
    maybeInitVimState_(cm: CodeMirror)
    +
    + Initialize cm.state.vim if it does not exist. Returns cm.state.vim. +
    + +
    handleKey(cm: CodeMirror, key: string, origin: string)
    +
    + Convenience function to pass the arguments to findKey and + call returned function if it is defined. +
    + +
    findKey(cm: CodeMirror, key: string, origin: string)
    +
    + This is the outermost function called by CodeMirror, after keys have + been mapped to their Vim equivalents. Finds a command based on the key + (and cached keys if there is a multi-key sequence). Returns undefined + if no key is matched, a noop function if a partial match is found (multi-key), + and a function to execute the bound command if a key is matched. The + function always returns true. +
    + +
    suppressErrorLogging: boolean
    +
    Whether to use suppress the use of console.log when catching an + error in the function returned by findKey. + Defaults to false.
    + +
    exitVisualMode(cm: CodeMirror, ?moveHead: boolean)
    +
    Exit visual mode. If moveHead is set to false, the CodeMirror selection + will not be touched. The caller assumes the responsibility of putting + the cursor in the right place. +
    + +
    exitInsertMode(cm: CodeMirror)
    +
    + Exit insert mode. +
    +
    + +
    + diff --git a/doc/realworld.html b/doc/realworld.html deleted file mode 100644 index a8ff3590d1..0000000000 --- a/doc/realworld.html +++ /dev/null @@ -1,136 +0,0 @@ - - -CodeMirror: Real-world Uses - - - - - -
    - -

    CodeMirror real-world uses

    - -

    Contact me if you'd like - your project to be added to this list.

    - - - -
    - diff --git a/doc/releases.html b/doc/releases.html index f04b4dcad8..42227c7316 100644 --- a/doc/releases.html +++ b/doc/releases.html @@ -6,15 +6,17 @@