Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: codemirror/CodeMirror
base: master
head fork: liuhongchao/CodeMirror
compare: master
Checking mergeability… Don't worry, you can still create the pull request.
Commits on Aug 29, 2012
@marijnh marijnh Make StringStream.match return null when the match isn't at current p…

Closes #761
@marijnh marijnh Make right-click select-all work on some browsers
The hack is horrible, but it seems to do the trick.

Also simplifies context-menu handling somewhat.

Issue #755
@marijnh marijnh Add a .INI mode c565edc
Commits on Aug 30, 2012
@marijnh marijnh Revert "Add a .INI mode"
It turns out the properties mode already handles .ini files just fine.

This reverts commit 9afd96d94d65e27329887d16e8e2cd7f6ffed1d6.
Commits on Aug 31, 2012
@marijnh marijnh Fix assumption that StringStream.peek returns a string
Closes #776
@marijnh marijnh Save overhead of operation when polling doesn't find a change 6ba2481
@marijnh marijnh Simplify line content-node API, get rid of makeTab indirection a2257ba
@marijnh marijnh Change the way highlighting information is updated
 - Background parsing now never goes past the visible part of the

 - We only store style information for lines that are actually visible
   (and then keep it cached).

 - When the document changes, background highlighting always
   re-highlights from the change to the end of the visible part.

 - Gets rid of compareState mode methods and the hairy heuristic that
   tried to simulate it when absent.

 - The onHighlightComplete callback was removed, since it no longer
   really applies -- the document is only fully parsed when scrolled
   to its end.

This should help preserve memory (a huge document will no longer
immediately have parser state and highlighting information built up
for all lines, but only for the parts that you look at), and removes
the pathological case when you, for example, are typing at the top of
a huge XML document, and opening or closing a tag causes a whole
re-highlight to cascade all the way to the bottom because the
compareState will detect a change.

Issue #688
@marijnh marijnh Remove unused function copyStyles ee16009
Commits on Sep 03, 2012
@bfrohs bfrohs Add highlighting tests for Markdown mode. 0cae19e
@marijnh marijnh [vim keymap] Reset keymap after YY is pressed
Closes #774
@marijnh marijnh Remove obsolete before_script section in .travis.yml 5bc1e89
@bfrohs bfrohs [clojure mode] Check if +/- is immediately followed by digit before m…
…arking as leading sign

Closes #782

Correct highlighting for the following code snippet should highlight the + as an operator, and each 2 as a number (taken from

    (is (= 4 (+ 2 2)))
@marijnh marijnh Tweak context menu hack to make select-all reliable on FF
Issue #755
@marijnh marijnh Fix corruption of operation data introduced by 6ba2481 4ac5b7a
@marijnh marijnh Add CodeMirror.version to API aeccaf5
@marijnh marijnh Remove accidentally committed conflict junk 79fa0bd
Commits on Sep 04, 2012
@marijnh marijnh [shell mode] Fix unsafe use of object
Parsing the word constructor would look up words["constructor"], and
return Object.prototype.constructor instead of a style string.

Closes #793
@bfrohs bfrohs [markdown mode] Improvements to parsing and tester
(Squashed commit. Below are the original commit messages:)

- Add highlighting test for Markdown for consecutive backticks.

- Make it possible to wrap inline code in multiple backticks.

- Add highlighting test for Markdown mode to only allow a single space
  to separate brackets.

- Make it possible to separate bracket groups with a space.

- Allow for horizontal rules to use dashes.

- Allow for *any* number of -'s or ='s for setex headers.

- Remove requirement that the text for setext headers have to be

- Might revisit someday to work on this, but in the meantime, it's
  better to prevent regressions than to be picky about what would be
  highlighted in an ideal world.

- Correctly match single line footnotes with title.

- Match inline links in Markdown mode.

- Don't match unclosed code blocks.

- Get mode test highlighter in line with CodeMirror.highlight().

- It would be nice to use all native functions, to avoid having to update this manually each time.

- Fix tests per fixes made to mode test highlighter.

- Properly handle multiple classes for mode tests.

- More correct handling of EM and STRONG in Markdown mode.

  Per Markdown documentation: "You can use whichever style you prefer;
  the lone restriction is that the same character must be used to open
  and close an emphasis span." # This is the 15th commit message:

- Allow escaping of * and _ by surrounding with spaces.

  Per Markdown documentation:

  "But if you surround an * or _ with spaces, it’ll be treated as a
  literal asterisk or underscore."

- More correct support for inline code blocks.

- Adjust Markdown highlighting tests to fit readability, rather than
  100% conformance with Markdown documentation.

  Although unclosed italics, bold, and inline code would not be
  formatted by a Markdown parser, it is extremely helpful to have the
  styles added even when it is not yet closed. It may be a good idea
  to add an 'incomplete' flag for each at some point, in order to
  style it (and mark it) as different. Perhaps piggyback off of
Commits on Sep 05, 2012
@bfrohs bfrohs [markdown mode] More improvements to parsing and tester.
Markdown mode

- Add additional link tests and correctly match link titles on next

- Adjust tests code so sections (including "Basics") can be rearranged
  and removed easily without breaking the script.

- Add tests and fix highlighting for lists.

Test harness

- Sort styles in mode test script so "quote string" = "string quote".
@bfrohs bfrohs Prevent logo from causing a horizontal scrollbar at smaller viewport …

This was especially noticeable with non-default font-sizes. The wrapper div and additional pre are required due to using the font-size provided by the browser (using em throughout).
Commits on Sep 07, 2012
@bfrohs bfrohs Fully integrate mode tests into main test harness, with extra features.
- Integrated stex and Markdown mode tests into main test harness

- Added ability to restart tests partway through

- Added verbose option, to add message to output for *every* test

- Added ability to show verbose messages and run specific tests or all tests for 1+ mode(s) via location.hash

- Added support for custom messages (either return value [pass] or throw value [fail])

- Switched away from .innerHTML, .write(), etc in most places

- Make the progress bar actually 0px wide when 0% complete (and still keep padding)

- Added link to tests from each mode's demo page
@marijnh marijnh Stop creating unused CodeMirror instances in mode tests b306f7c
@marijnh marijnh Don't wait 50 ms between tests
There are now enough tests to make this take a serious amount of time.

A 0 timeout seems to work just as well.
@bfrohs bfrohs Prevent tests from locking up browser on slower machines (closes #805). fafa9d2
@marijnh marijnh Fix a number of ECMA-5-isms in the test runner
We do still support IE7/8.

Also removes some non-CodeMirror-code-style things like left-aligned
commas and semicolons.
@bfrohs bfrohs A few small improvements to the test suite:
- Move unchanging styles for #progress to style sheet

- Forgot to update testCM() when I added the `verbose` option
@dagsta dagsta Extend closetag to work with html / PHP Mixed Code
I just added support for closing Tags inside a file in "application/x-httpd-php" Mode including HTML Code
@marijnh marijnh [util/closetag] Clean up handling of different modes 1cea077
@marijnh marijnh [util/closetag] Fix problem introduced by previous patch 2d38a15
Commits on Sep 10, 2012
@bfrohs bfrohs Reset `verbose` flag when running tests. ba11716
@bfrohs bfrohs Fix bug with duplicate test names starting out at the wrong number.
If two tests have the name "foo", the second should appear as "foo_2", but instead it appeared as "foo_3".
@bfrohs bfrohs Add a text-shadow behind test progress text so it's readable while th…
…e progress bar hasn't passed yet.
@bfrohs bfrohs Add tests for CSS mode and fixed found bugs
- Added link to tests on mode page
- More consistent naming with CSS spec (some of the previous var naming was completely incorrect/misleading)
- Improved highlighting
  - Match vendor prefixes
  - Check for known properties and values (known properties are bold, unknown are not)
  - Added highlighting for media queries
- Cleaner stacking of state
@marijnh marijnh [css mode] Partially move back to old look fdfba6d
@marijnh marijnh On Webkit, add file/line no to test failures caused by errors 328780d
@marijnh marijnh Make undo/redo preserve text markers and bookmarks
Cleans up the implementation of marked ranges, makes the data
structure for markers-within-a-line persistant, and attaches them to
the lines stored in the undo history when necessary.

Closes #675
@marijnh marijnh Introduce a lst() function to reduce arr[arr.length-1] noise 9a7a53c
@marijnh marijnh Downcase package name in package.json d00082a
@marijnh marijnh Add a Common Lisp mode f23da64
@marijnh marijnh [commonlisp mode] Fix accidental global db012e8
@marijnh marijnh [commonlisp mode] Various small fixes 8556412
@marijnh marijnh Add node.js-capable runMode implementation 53b6852
@marijnh marijnh Further minimize runmode-standalone.js, fix failing build 4ec75a9
Commits on Sep 11, 2012
@marijnh marijnh Add startStyle and endStyle options for markers
Closes #819
Commits on Sep 12, 2012
@marijnh marijnh Add new state introspection mechanism for nested modes
And move closetag over to it.

This makes the code that gets the XML state out of the mode actually
sound and extensible.

Issue #820
@marijnh marijnh [util/formatting] Move over to new mode extension/introspection
This makes the formatter easier to adjust to new mode, and
cleans it up somewhat.
@marijnh marijnh [util/formatting] Fix a bunch of bugs
That's what you get when you test with the published version,
rather than the one you're actually editing.
@marijnh marijnh Add NoTex to real-world uses 95b5962
Commits on Sep 17, 2012
@bfrohs bfrohs Fix formatting demo's "[Un]Comment Selected" functionality (closes #826
@marijnh marijnh [javascript mode] Fix variable-scope-restoration 275d6ed
@marijnh marijnh [util/simple-hint] Capture pageup/pagedown keys 52cfc2e
Commits on Sep 18, 2012
@marijnh marijnh [vb mode] Highlight Try/Catch keywords af77559
@marijnh marijnh Make output of getHistory JSON-serializable again 949bcc4
@marijnh marijnh Flip ctrlKey and metaKey properties on Opera Mac
I don't know what they were thinking, but this, on
recent Opera versions, seems to give the correct

Closes #10
Commits on Sep 19, 2012
@marijnh marijnh [commonlisp mode] Fix bug in context management da3a289
@marijnh marijnh Mark release 2.34 fc17d2d
@marijnh marijnh Bump version post-release 230d532
Commits on Sep 25, 2012
@marijnh marijnh Fix git URL in doc/compress.html 553ce94
Commits on Sep 28, 2012
@marijnh marijnh [util/simple-hint] don't close hint dialog when a modifier key is pre…

Closes #853
@marijnh marijnh Fix setOption('tabindex', ...) 19f0d06
@feizhang365 feizhang365 Update lib/util/searchcursor.js
fix reverse Regexp match which cause memory leak
@marijnh marijnh [demo/mustache] Recognize triple braces e8b2cb7
@marijnh marijnh Don't do overwrite when pasting 64d2081
@ahoward ahoward embedded ruby configuration cede207
@marijnh marijnh [javascript&clike modes] Indent block comments with CodeMirror.Pass
This'll align them with the previous line. It's not a perfect solution,
but probably better than simply returning 0.

Issue #854
@marijnh marijnh Add gittip donation link 831a3a5
@marijnh marijnh [javascript mode] Fix suble parsing bug in for loop specs 07e933a
@marijnh marijnh Ensure block-indent doesn't use outdated state
Closes #844
Commits on Oct 02, 2012
@bfrohs bfrohs [markdown] Fix performance issue with regex matching of single closin…
…g chars (closes #862).

Also avoid a global variable that snuck through.
@rzhw rzhw Make runmode escaping global dc768cc
Commits on Oct 03, 2012
@bfrohs bfrohs [markdown mode] A few fixes for highlighting.
- Prevent "markdown_hrDashLong" test from failing when runHarness() is called manually.

- Render EM / STRONG within link text (closes #823).

- Add highlighting for images (closes #824).
@bfrohs bfrohs [markdown] Fix bug with false positive matches of inline links.
- Inline links (square brackets followed by parentheses) cannot be separated by space (per Documentation and Dingus).

- Added test that checks both for this and correct highlighting of square brackets by themselves.
@bfrohs bfrohs [Markdown] [GFM] Rewrite GFM to inherit changes from Markdown mode be…

- Add options to Markdown mode to make it easier to extend
- Add GFM text overlay
  - SHA, User@SHA, and User/Project@SHA
  - #Num, User/#Num, and User/Project#Num
  - Vanilla URLs
- Add GFM-specific tests
- Fix overlay code so blankLine() is called
@marijnh marijnh Another kludge in measureLine/lineWrapping interaction
Opening a new span between letters apparently *causes* the browser
to consider that element start to be a good place to break. This
adds zero-width joiners in such a situation to prevent this from

Closes #867
@bfrohs bfrohs Add note about mode dependency and links to highlighting tests. 84baea5
Commits on Oct 04, 2012
@bfrohs bfrohs [markdown mode] Fix highlighting for code blocks with internal indent…
@marijnh marijnh [simplehint util] Support completeSingle option
To turn off the behavior where it'll always complete when only
a single option is left.
@marijnh marijnh [keymap/vim] Stop using .forEach on arrays 525f15c
@marijnh marijnh Set pre elements to overflow: visible
Some sites set them to auto, which messes up our cursor (and probably more)
Commits on Oct 15, 2012
@marijnh marijnh [util/simple-hint] Align completion dropdown with completed word
Add alignWithWord option to be able to turn that off.
@bfrohs bfrohs [css] Fix class matching.
This basically matches the CSS3 spec (except it doesn't match non-ascii characters).
@marijnh marijnh Don't mutated makedSpans arrays
And add marker changes to the undo history, so that
un/redoing doesn't cause 'ghost' markers to appear.

Closes #882
@ks-ifware ks-ifware Fixed multi-line Lua comment recognition
Multi-line Lua comments start with "--[[", not "--["
@bfrohs bfrohs Fix typo in manual. ebcd76e
@marijnh marijnh Fix typo (lenght) fdf78f7
Commits on Oct 16, 2012
@ComFreek ComFreek Merged JavaScript and TypeScript mode as marijnh suggested 5ea1eb9
@marijnh marijnh Make typescript mode recognize type declarations b3c1c79
@marijnh marijnh Fix removing of spans 2b6d796
@marijnh marijnh Remove copyright header
(git is the authoritative source of who wrote what)
@marijnh marijnh Add defineInitHook functionality ac059ff
Commits on Oct 18, 2012
@marijnh marijnh Different approach to ensuring marker.clear works well with undo
The previous approach was quite misguided.
Commits on Oct 19, 2012
@feizhang365 feizhang365 Update lib/codemirror.js
fix double click to select a Chinese word in quotes bug:
e.g:<div name='新增'>新增</div>  double click to select word 新增   
@marijnh marijnh [javascript mode] Handle semicolon-less code better
Closes #898
@marijnh marijnh [javascript mode] Also count on semicolon omittance in var lists
Issue #898
@marijnh marijnh Add expanded list of real-world uses as a separate page
So that I don't have to say 'no' so often
Commits on Oct 22, 2012
@marijnh marijnh Add more real-world uses f5bb594
@marijnh marijnh Mark release 2.35 35846db
@marijnh marijnh Bump version number post-2.35 031221f
Commits on Oct 23, 2012
@marijnh marijnh Add local compression helper 9101e20
@marijnh marijnh [xml mode] Better handle HTML-style attributes
Allow slashes and question marks in unquoted attribute values
(not sure why those were disallowed in the first place) and
properly style the token after a value-less attribute.

Closes #904
Closes #902
@marijnh marijnh Make layout adjust better to narrow windows
Closes #878
Commits on Oct 24, 2012
@marijnh marijnh Allow one pixel difference between scrollbar and scroller position
Otherwise, at some zoom levels, rounding errors would cause a
feedback loop that made the scroll position 'drift'.

Closes #907
Commits on Oct 25, 2012
@marijnh marijnh Make autoformat work with JSON mode 0225793
@marijnh marijnh Add scrollIntoView method d1c702d
Commits on Oct 29, 2012
@marijnh marijnh Add defaultTextHeight method 503a333
@marijnh marijnh Add Farabi to real-world uses 371c949
@marijnh marijnh [mysql mode] Support /* */ comments 399e00c
@marijnh marijnh Only try to override escape key event keyCode on old IEs
It's no longer allowed on IE10, and not needed on IE9.

Issue #911
Commits on Oct 30, 2012
@marijnh marijnh Add XOSide and TurboPY to real-world uses b15a531
@marijnh marijnh Make Chinese and Japanese characters count as word characters
Closes #901
Commits on Nov 08, 2012
@marijnh marijnh [util/xml-hint] Remove some truly weird code 8455cde
Commits on Nov 09, 2012
@peterkroon peterkroon Update doc/realworld.html
Fix syntax
@marijnh marijnh Add jsdares to realworld.html 5cb56bb
@marijnh marijnh Remove link to twitter rss feed
They no longer work (as part of twitters continuing quest to
make itself obsolete).
@marijnh marijnh Use the google groups feed as alternate link instead f0d578c
@dneelyep dneelyep Added keybindings for page up/down in emacs mode. ebbbad2
@dneelyep dneelyep Added keybinding for insert newline+indent. 0b0770e
@marijnh marijnh [emacs map] Clean up and add a few more bindings 63f1d8e
@bfrohs bfrohs Fix typo in release notes. a67c57f
@marijnh marijnh [python mode] Don't prescribe indentation for multi-line strings 9039744
Commits on Nov 10, 2012
@fe9lix fe9lix Add ambiance-light theme with better performance on mobile devices 6f25579
Commits on Nov 12, 2012
@DThought DThought Add z80 mode 5776a34
@marijnh marijnh Remove ambiance-light theme, simply add an extra file that can be use…
…d to disable box-shadow

Issue #974
@mightyguava mightyguava [vim keymap] Lots of fixes for navigation.
Go to line with Shift+G works again.
Updated navigation behavior to match closer to vim.
dw/de at end of line will no longer delete newline.
@marijnh marijnh Remove jsdares from real-world use list again 7b6c49b