Since .apply() can't handle more than 65535 parameters, splice.apply()
is brittle. It's also hard to read. This replaces splice.apply() calls
throughout ace code with lang.spliceIntoArray().
This makes it possible to break out helper functions without exposing
them to the rest of the document class. Also, long term, we may want to
have a stand-alone test suite for applyDelta, so it makes sense in its
own file.
All other changes involve syntax corrections (some syntax issues were
mine, others pre-existed) to make the documentation compilation work.
2e6f12725b slowed down the application of
deltas that only affect a single line. The slow-down, though trivial for
a single line, is significant for operations than separately modify
thousands of rows (such as indenting a large document).
This commit speeds up single-line deltas by avoiding unnecessary calls
to splitLine() and joinLineWithNext().
This seeks to keep the public API in-tact while improving method names
within ace by keeping the old methods as wrappers around the new
better-named methods.
For example, document.insert() now simply calls document.insertText()
and warns the caller via a console.log() that they are using a
deprecated method.
I've also updated the coding style of my changes (where I noticed
discrepancies) to match the rest of Ace.
Refactor delta handling code to:
- Combine the "insertText" and "insertLines" delta types into a single
"insert" delta type
- Combine the "removeText" and "removeLines" delta types into a single
"remove" delta type
- Make all document mutations in a single applyDelta function.
- Add basic delta validation (more needed . . . see TODOs)
- Rework anchor logic to handle new delta types (also simplified)
- Rename "insert()" to "insertText()" and "remove()" to "removeText()"
- Rename "insertLines()" to "insertFullLines()" and "removeLines()" to
"removeFullLines()"
See related issue for more information. All tests are passing and the
changes appear functional under preliminary testing, but careful review
and testing will be necessary.
As per Harutyun Amirjanyan's request I made the following two changes:
1) Added c-style behavior and fold mode.
2) Updated mode syntax for mel to current one used by Ace.