The markup for array-of-tables at https://github.com/toml-lang/toml#array-of-tables is
[[ foo ]]
Right now, the last ] isn't part of the markup. Figured making this an explicit token is the most apparent way to fix this.
Just copied over the Clojure indentation rules to Scheme and changed
the keywords to suit the language, so that Scheme programs can be
automatically indented too
Fix typeerror "Cannot read property 'container' of undefined" when using live autocomplete. Error can occur when editor loses focus and the autocomplete popup has never been shown.
The whole meta string currently gets dropped from the autocompletes
popup if it doesn't fit. This leads to confusing autocompletes where
the meta for some entries are missing for no apparent reason.
So, instead of dropping the entire meta string when it doesn't fit,
insert what we can and append "..." to communicate that we clipped it.
This is to add Django as an alternative mode for HTML files. The placement of the entry is to ensure that Django syntax highlighter does not override HTML syntax highlighter.
in combination with PUT support in ./static.py (or whatever other web server)
this allows people to save both the highlighting rules and the demo documents right
from the mode editor for a better workflow.
# By nightwing (7) and others
# Via Harutyun Amirjanyan (4) and others
* 'master' of https://github.com/ajaxorg/ace:
do not pair quotes inside strings
fix toggleComment command in php mode
fix copyLines* for multiple selections
fix pairing of quotes in cstyle behavior
add helper for creating tests
Autocomplete exactMatch option
add *~ (backup files created by various editors) to .gitignore
Remove unneeded regex groups for Eiffel
Update Eiffel programming language definition.
add config.warn and refactor config to allow sharing with ace_tree
do not use automatic scroll into view
Teach tmlanguage.js to process multiple .tmLanguage files at once
You can now pass more than one .tmLanguage file to tmlanguage.js and it will
process each one in turn. This can vastly speed up the processing of multiple
files as you don't have to pay the node/V8 startup cost for each file.
Note that the script's "dev mode" is now controlled by a --dev flag rather than
an unnamed second argument.
The `\ref`, and `\cite` commands in LaTeX are similar to `\label`s in that they refer to user defined labels elsewhere in the text, and it makes sense to highlight them with the same color scheme. Particularly the coloring of arguments to `\ref` commands should match the color of `\label` commands because `\label` defines the strings that `\ref` then references.
End range should be at end of line as we don't want to display the
'#endregion' text after the fold widget (this is consistent with cstyle
region comment folding).
Added missing semi-colons.
Rename this.getFoldWidgetBase to avoid conflict with C# mode.
Use regex instead of substring and trim to determine single line block
comment.
Fixed formatting.
Renamed this.getRegionBlock to this.getCommentRegionBlock to prevent C#
mode conflict.
Updated this.getCommentRegionBlock regex to make nested regions work
properly.
Cleaned up this.startRegionRe (had unneeded parenthesis).
Offsetting the fontMetrics div causes the 'ghost image' created when
drag and dropping an Ace Editor to be offset by that same amount. By
removing the offset we fix the problem. Closes#2240.
Allow tooltips in div element (currently tooltips only allow items in pre element which is tricky to format). Also fix wrapping, remove gradient fill, and introduce a maximum width of 500px by default.
Added setCompleters() method, so that completers can be explicitly set from a pre-populated array, or can be removed entirely (if null is passed, or setCompleters() is called without an argument or an empty array is passed.
Please check this carefully for rookie JavaScript bugs, as I'm not sure if the null/undefined test is best-practise here as I don't typically code in JavaScript in my day-job.
Added removeCompleters() function to language tools exports as it is not possible to access the completers array directly.
This is currently utilized by Ace GWT to cleardown existing completers (for entirely programmatic completers without snippets or keyword completions) but I feel it belongs in the mainline (I have to manage a fork at the moment and there seems to be no other workaround).
When setUseWrapMode is true, if some text is inserted into a line which is
above the cursor and offscreen, then the renderer did not previously redraw the
lines or active line highlight. However, if this insert causes the line to wrap
onto another line then everything is shifted down by one visual line, leaving
the onscreen lines in an out of date state. With this commit, the onscreen
lines and active line highlight are now redrawn when this happens.
expandtoline - selects the entire line for each line in a selection (newline included)
joinSelection - joins selected lines into a single space-delimited line
invertSelection - inverts all selected lines
This prevents highlighting on the "2" in "auth: oauth2". (signing CLA and sending in now)
Now passes tests and also covers .37 case.
… and updated to cover the ++ or -- case.
If either the theme or mode are already cached, callback will be fired more than once.
This is because `config.loadModule` appears to fire its callback synchronously. This means that in the event that the theme is already cached, `waiting` will first be incremented then decremented in the same pass, resulting in `done` being called a first time.
Control will then flow to the `return` statement where waiting is still `0` and so the `callback` will fire a 2nd time.
* Changes *
Instead of changing the semantics of `config.loadModule`, I increment waiting at creation so that it will never fire until at least line #130 (`return` statement).
Update language_tools to support pass in completers at enableLiveAutocomplete and enableBasicAutocomplete so user can further customize the completion behavior.
Fixes error:
```
[object Object] has no method 'Node_Expr_BitwiseXor'
```
Which results from using xor e.g:
```
error_reporting(E_ALL ^ E_NOTICE);
also reported to phpjs project:
https://github.com/niklasvh/php.js/pull/48
The only situation where this is really needed, is if the workerURL is
protocol relative, since we only end up in this situation if workerurl
is on a different server to begin with.
This makes live autocomplete optional and is not tied to
“enableBasicAutocomplete” anymore
This also renames “onChangeAutocomplete” to “doLiveAutocomplete”
Autocomplete: Display unique results when it's a snippet
Fix autocomplete popup display
Remove listener for afterExec when enableBasicAutocompletion change
Fix autocomplete detach when no results are ready from the first completer
Remove condition from detach
It appears these were simply missed in the original license change
(ajaxorg/ace#1622). Discussion on that pull request confirms that these
should have been included.
I've found that the set of modes in this PR did not set their `$id`.
The side-effect of that is that when one of these modes is the current
mode of an EditSession, and one calls `session.getOption('mode')` the
returned value was incorrect. It goes up the prototype chain so you'd
get something like 'ace/mode/text' or 'ace/mode/html' in most cases.
This fixes that so that if, for example, the mode is set to
'ace/mode/django', the value returned by the option will be
'ace/mode/django'
There is no 'this' in lua. There is however 'self' a predefined parameter when using colon syntax for calling a function.
http://www.lua.org/pil/16.html
Stores single-line delta content as .text instead of .lines in undo
history. This is done without modifying the original delta object in
case the caller still retains a handle to the original.
This uncovered the fact that until now delta.range had not always been a
Range object. This inconsistency has been resolved by my changes in
mirror.js.
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.
Improvements:
- It's now possible to list dependencies that gets loaded before calling the factory-function
- Relative paths without folders (./foo) now works properly
- The define()-behaviour is now tested by four unit-tests
This fixes a bug where if you have 2 instances of EditSession and you
`setWrapLimitRange` on one of them it would affect the $wrapLimitRange
on all other instances of EditSession.
- added changes from
wiki.secondlife.com/wiki/Release_Notes/Second_Life_RC_LeTigre/13#13.06.21.277682
to highlight rules and snippets
- reviewed invalid grammar and text mode test
lsl_highlight_rules.js:
- added stuff from RC Le Tigre 13.06.06.277104
- made stuff more readable while staying within 80 columns width
snippets.lsl
- sorted
- added stuff from RC Le Tigre 13.06.06.277104
register all partial key combos as null commands
to be able to activate key combos with arbitrary length
Example: if keyPart is "C-c C-l t" then "C-c C-l t" will
get command assigned and "C-c" and "C-c C-l" will get
a null command assigned
Slight adjustment to the visibility of `.ace_fold-widget` so that when the `.ace_folding-enabled` flag is toggled, so is the widget's visibility. This addresses the issue where the left-most edge of the folding widgets may still be visible after disabling code. folding
I refactored all requires to point at `ace/ext/modelist` deleted the
build directory and did a full rebuild. In both the kitchen sink and the
mode creator I was able to use the mode lists and see an immediate
reaction in the applications. I think it worked out. :D
I copied the modelist.js file from the kitchen sink demo and added doc
comments to the exported methods.
This module would be extremely helpful to anyone implementing a menu
system or who wanted to programatically switch rendering modes based on
the file extension of the file loaded into ace. I can think of several
use cases for it already. (1) in the settingsMenu branch. (2) in
supporting theme switching for anyone implementing drag and drop support
for loading files into the editor (3) in supporting theme switching for
sites implementing their own file picker dialogues and loading content
into ace through xmlhttprequest (4) in supporting filebrowser / editor
applications where a server could be set up to display file contents in
an ace editor as users browsed to arbitrary files. (5) etc. etc.
Had I known about it when I began writing the settingsMenu branch I
would have used it.
This branch now depends on the modelist being pulled in as a module. I'm
using the modelist to generate the menu options for switching modes
because it's redundant to have the same massive list in two places.
The modelist module also has some awesome features so I choose it over
my silly list. :D
When the editor takes up the entire window and the window is only half
the size of my screen, the menus get crunched up horribly. I'll provide
for closing the overlay by pressing esc in case the overlay's contents
take up the entire screen.
If ace is to be used in very small frames then implementors will need to
provide styling information in css to control how the settings menu
looks.
The overlay menu should remain visible when scrolling a long page. The
intention is to present information on demand and not leave the menu on
screen. If allowed to scroll away the remaining element could interfere
with the page.
I pulled the code for generating the menu out into its own module called
overlay_page. I pulled the code for generating a menu, using
overlay_page, out into its own module called show_keyboard_shortcuts.
The logic for getting a list of keyboard shortcuts pertinent to the
current operating system is by itself in the module
get_editor_keyboard_shortcuts. This should make it easy for anyone to
change the appearance of the menu without worrying about breaking the
code which fetches the data.
I'm not set on the keybinding or the aesthetics of this. please change
them at will. The main goal here is to provide some method to list all
the keyboard shortcuts dynamically. I mean that when new shortcuts are
added they should automatically be put into this menu without anyone
writing any extra code. The menu provides a way for end users to easily
discover the many built in functions accessible through the keyboard.
Admittedly the current keybinding to display this menu is not very
convenient or easily guessed. I like the way that the textarea version
of ace presents a single clickable corner that is easily identified by
users. It would be cool to make this pretty and obvious.
I lowercased the file names. I've separated the code to generate an
overlay menu out into a module called overlay_page, it is the same code
as is in my other pull request for the keyboard shortcuts menu. It
should be easy enough to change the way it looks and behaves without
worrying about breaking anything. I've pulled code out into a module
called element_generator because it is pretty generic and isn't
concerned with gathering data for the settings menu. The element
generator can be reused and augmented but there is the possibility that
modules depending on it could break. show_settings_menu depends on the
element_generator. As it collects data it generates generic elements and
attaches event listeners to them. The massive list of options has been
moved into its own module for two reasons (1) it makes maintaining
show_settings_menu much easier and (2) this is the only part of the menu
which has to be updated manually. We may be able to add something to the
build system to automatically generate this module based on which modes
and themes are found to alleviate us from having to remember to add said
options in when new themes and modes are added.
I'm not stuck on the keybinding or aesthetics of this, please change
them at will. All I really want is the ability to display a menu where I
can change the editor's settings from and I want the menu to be smart
enough to automatically know about new settings. This pretty much works
except there isn't a registry for themes and modes so every new theme or
mode has to be added to the internal list by hand...
Is this the right way to use the static highlighter with the
noconflict build?
Edit as necessary. This is about as good as I can get it...
loads modules from script tags
makes div visible after highlighting
fixes display (sort of)
codeEl margin & padding 0
editor overflow auto, gutter position relative
replace code element with div
mode can be specified as a string
mode and theme may be specified as strings
This preserves the behavior of this method when specifying mode and
theme as objects. It adds the ability to specify mode and theme as
module paths. When specifying mode and / or theme as a module path you
must provide a callback function. The callback function will receive the
same value as the return value previously returned when specifying mode
and theme as objects.
Good stuff.
multiple elements with different modes and themes
The example shows multiple elements highlighted with different modes and
themes all in the same page. The pre element isn't ideal.
The example shows how to transfer the computed width and height of the
element into its inline style so that it won't dramatically change shape
and disrupt the page once it's had highlighting applied. It would
probably be better to replace the elements entirely and apply sizing
styles to the replacement elements but that isn't always an option.
This addressed an issue where the newlines generated when including snippet files does not contain newline characters, this causes SnippetManager.parseSnippetFile to always return empty.
Instead, of creating actual newlines and a multiline string with \, this adds newline characters.
Add indent guide to theme.
Modify ace_fold to be more subtle (the big inline ace_fold widgets are a bit distracting on this dark theme).
This is true to the original Chaos theme (Space Editor).
I use regex searches all the time for finding and replacing text
so I changed the searchbox extension a little bit to do what I want.
I added in the whole word and case sensitive options too. It works
nicely and updates the highlighted bits when the checkboxes change.
The search/replace buttons are seen as "submit" type because the type attribute
is not specified. If ACE is embedded within a form (between <form>...</form>)
clicking on one of these button will submit the outer form.
Setting search/replace buttons type to "button" prevents the outer form to be
submitted.
changes $arrayTokens to use exec instead of split
1 it works on ie8
2 it is faster on chrome http://jsperf.com/capturing-split-vs-exec
unfortunately exec is slow on firefox but ff regexes are a bit rusty atm (v21), and whole tokenizer is slow on it anyway.
modified: demo/kitchen-sink/docs/scheme.scheme
* fix typo
modified: lib/ace/mode/scheme_highlight_rules.js
* remove '() since it's hard to parse and trivious for coloring.
* keyword and constant coloring fine now.
added 'themeLoaded' event that is dispatched right after a theme is loaded.
it can be used like this :
this.editor.renderer.on('themeLoaded',function(){
//do something when the theme is loaded
});
non identifier chars in \u00a1-\uffff range are errors anyway
so they can be highlighted either as operator or as identifier
using this instead of detailed unicode regexps reduces parse time
by ~3x, and gives the same result for any valid js
* Support single-line blocks: don't indent the following line.
* Indent the line following a line with unclosed parentheses, such as a
function call where some parameters are specified on the same line as
the name.
* Use a negative next-line indent to restore the correct indenting level
after the end of a multi-line parenthesized block where the ending
parenthesis occurs with other text on the same line as it.
* Implement outdenting. Outdenting is triggered after "enter" is pressed,
similar to the Python mode. This avoids problems with incomplete token
information, e.g. outdenting when the user is halfway through typing a
quoted string "the end is nigh", where "end" is recognised as a
keyword until the right quote is present.
Of course it is still flawed, anything less than a complete Lua parser will
be flawed, but I'm pretty confident that the code here is better than
what came before.
We've added support for DOM3 Keyboard Events (and cleaned up things)
generally--so this workaround won't be needed when those changes
land in a stable version of Opera. This change allows older versions
of Opera to continue working.
Default monospace font on Windows is now Consolas, which is a great one, then remove Courier New, because monospace is better on Linux systems; and if there is no nice monospace font it'll fall back to Courier anyway.
The original keyboard event is now passed on, and `$composeBuffer` is
returning with an extra property `keyIdentifier`, which contains the
Unicode id of the pressed keybinding.
When editor is not at the top of the page (requires scrolling), textarea
right-click context menu will fail to appear.
Use clientX and clientY which returns the relative coordinates instead
of pageX and pageY.
Ace is a community project and wouldn't be what it is without contributions! We actively encourage and support contributions. The Ace source code is released under the BSD License. This license is very simple, and is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings!
Feel free to fork and improve/enhance Ace any way you want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. To protect the interests of the Ace contributors and users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is the simplest of agreements, requiring that the contributions you make to an ajax.org project are only those you're allowed to make. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes ten minutes, and only needs to be completed once.
There are two versions of the agreement:
1. [The Individual CLA](https://docs.google.com/a/c9.io/forms/d/1MfmfrxqD_PNlNsuK0lC2KSelRLxGLGfh_wEcG0ijVvo/viewform): use this version if you're working on the Cloud9 SDK or open source projects in your spare time, or can clearly claim ownership of copyright in what you'll be submitting.
2. [The Corporate CLA](https://docs.google.com/a/c9.io/forms/d/1vFejn4111GdnCNuQ6BfnJDaxdsUEMD4KCo1ayovAfu0/viewform): have your corporate lawyer review and submit this if your company is going to be contributing to the Cloud9 SDK and/or open source projects.
If you want to contribute to the Cloud9 SDK and/or open source projects please go to the online form, fill it out and submit it.
Ace is a standalone code editor written in JavaScript. Our goal is to create a browser based editor that matches and extends the features, usability and performance of existing native editors such as TextMate, Vim or Eclipse. It can be easily embedded in any web page or JavaScript application. Ace is developed as the primary editor for [Cloud9 IDE](http://www.cloud9ide.com/) and the successor of the Mozilla Skywriter (Bespin) Project.
_Note_: The new site at http://ace.c9.io contains all the info below along with an embedding guide and all the other resources you need to get started with Ace.
Ace is a standalone code editor written in JavaScript. Our goal is to create a browser based editor that matches and extends the features, usability and performance of existing native editors such as TextMate, Vim or Eclipse. It can be easily embedded in any web page or JavaScript application. Ace is developed as the primary editor for [Cloud9 IDE](https://c9.io/) and the successor of the Mozilla Skywriter (Bespin) Project.
Features
--------
* Syntax highlighting
* Syntax highlighting for over 110 languages (TextMate/Sublime/_.tmlanguage_ files can be imported)
* Over 20 themes (TextMate/Sublime/_.tmtheme_ files can be imported)
* Automatic indent and outdent
* An optional command line
* Handles huge documents (100,000 lines and more are no problem)
* Fully customizable key bindings including VI and Emacs modes
* Themes (TextMate themes can be imported)
* Handles huge documents (at last check, 4,000,000 lines is the upper limit)
* Fully customizable key bindings including vim and Emacs modes
* Search and replace with regular expressions
* Highlight matching parentheses
* Toggle between soft tabs and real tabs
* Displays hidden characters
* Drag and drop text using the mouse
* Line wrapping
* Unstructured / user code folding
* Live syntax checker (currently JavaScript/CoffeeScript)
* Code folding
* Multiple cursors and selections
* Live syntax checker (currently JavaScript/CoffeeScript/CSS/XQuery)
* Cut, copy, and paste functionality
Take Ace for a spin!
--------------------
Check out the Ace live [demo](http://ajaxorg.github.com/ace/) or get a [Cloud9 IDE account](http://run.cloud9ide.com) to experience Ace while editing one of your own GitHub projects.
Check out the Ace live [demo](http://ace.c9.io/build/kitchen-sink.html) or get a [Cloud9 IDE account](https://c9.io/) to experience Ace while editing one of your own GitHub projects.
If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookmarklet](http://ajaxorg.github.com/ace/build/textarea/editor.html).
History
-------
Previously known as “Bespin” and “Skywriter” it’s now known as Ace (Ajax.org Cloud9 Editor)! Bespin and Ace started as two independent projects, both aiming to build a no-compromise code editor component for the web. Bespin started as part of Mozilla Labs and was based on the canvas tag, while Ace is the Editor component of the Cloud9 IDE and is using the DOM for rendering. After the release of Ace at JSConf.eu 2010 in Berlin the Skywriter team decided to merge Ace with a simplified version of Skywriter's plugin system and some of Skywriter's extensibility points. All these changes have been merged back to Ace. Both Ajax.org and Mozilla are actively developing and maintaining Ace.
Getting the code
----------------
Ace is a community project. We actively encourage and support contributions. The Ace source code is hosted on GitHub. It is released under the Mozilla tri-license (MPL/GPL/LGPL), the same license used by Firefox. This license is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings!
```bash
git clone git://github.com/ajaxorg/ace.git
cd ace
git submodule update --init --recursive
```
If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookmarklet](http://ajaxorg.github.io/ace/build/demo/bookmarklet/index.html).
Embedding Ace
-------------
Ace can be easily embedded into any existing web page. The Ace git repository ships with a pre-packaged version of Ace inside of the `build` directory. The same packaged files are also available as a separate [download](https://github.com/ajaxorg/ace/downloads). Simply copy the contents of the `src` subdirectory somewhere into your project and take a look at the included demos of how to use Ace.
Ace can be easily embedded into any existing web page. You can either use one of pre-packaged versions of [ace](https://github.com/ajaxorg/ace-builds/) (just copy one of `src*` subdirectories somewhere into your project), or use requireJS to load contents of [lib/ace](https://github.com/ajaxorg/ace/tree/master/lib/ace) as `ace`
You find a lot more sample code in the [demo app](https://github.com/ajaxorg/ace/blob/master/demo/demo.js).
Additional usage information, including events to listen to and extending syntax highlighters, can be found [on the main Ace website](http://ace.c9.io).
There is also some documentation on the [wiki page](https://github.com/ajaxorg/ace/wiki).
You can also find API documentation at [http://ace.c9.io/#nav=api](http://ace.c9.io/#nav=api).
If you still need help, feel free to drop a mail on the [ace mailing list](http://groups.google.com/group/ace-discuss).
Also check out the sample code for the kitchen sink [demo app](https://github.com/ajaxorg/ace/blob/master/demo/kitchen-sink/demo.js).
If you still need help, feel free to drop a mail on the [ace mailing list](http://groups.google.com/group/ace-discuss), or at `irc.freenode.net#ace`.
Running Ace
-----------
After the checkout Ace works out of the box. No build step is required. Open 'editor.html' in any browser except Google Chrome. Google Chrome doesn't allow XMLHTTPRequests from files loaded from disc (i.e. with a file:/// URL). To open Ace in Chrome simply start the bundled mini HTTP server:
After the checkout Ace works out of the box. No build step is required. To try it out, simply start the bundled mini HTTP server:
```bash
./static.py
@ -117,44 +106,41 @@ After the checkout Ace works out of the box. No build step is required. Open 'ed
Or using Node.JS
```bash
./static.js
npm install mime
node ./static.js
```
The editor can then be opened at http://localhost:8888/index.html.
The editor can then be opened at http://localhost:8888/kitchen-sink.html.
Package Ace
To open the editor with a file:/// URL see [the wiki](https://github.com/ajaxorg/ace/wiki/Running-Ace-from-file).
Building Ace
-----------
To package Ace we use the dryice build tool developed by the Mozilla Skywriter team. Before you can build you need to make sure that the submodules are up to date.
You do not generally need to build ACE. The [ace-builds repository](https://github.com/ajaxorg/ace-builds/) endeavours to maintain the latest build, and you can just copy one of _src*_ subdirectories somewhere into your project.
However, all you need is Node.js and npm installed to package ACE. Just run `npm install` in the ace folder to install dependencies:
```bash
git submodule update --init --recursive
npm install
node ./Makefile.dryice.js
```
Afterwards Ace can be built by calling
To package Ace, we use the dryice build tool developed by the Mozilla Skywriter team. Call `node Makefile.dryice.js` on the command-line to start the packing. This build script accepts the following options
```bash
./Makefile.dryice.js normal
-m minify build files with uglify-js
-nc namespace require and define calls with "ace"
-bm builds the bookmarklet version
--target ./path specify relative path for output folder (default value is "./build")
```
The packaged Ace will be put in the 'build' folder.
To build the bookmarklet version execute
```bash
./Makefile.dryice.js bm
```
To generate all the files in the ace-builds repository, run `node Makefile.dryice.js full --target ../ace-builds`
Running the Unit Tests
----------------------
The Ace unit tests run on node.js. Before the first run a couple of node modules have to be installed. The easiest way to do this is by using the node package manager (npm). In the Ace base directory simply call
```bash
npm link .
```
To run the tests call:
The Ace unit tests can run on node.js. Assuming you have already done `npm install`, just call:
```bash
node lib/ace/test/all.js
@ -167,20 +153,16 @@ You can also run the tests in your browser by serving:
This makes debugging failing tests way more easier.
Contributing
------------
-----------------------------
Ace wouldn't be what it is without contributions! Feel free to fork and improve/enhance Ace any way you want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. To protect the interests of the Ace contributors and users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is the simplest of agreements, requiring that the contributions you make to an ajax.org project are only those you're allowed to make. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes ten minutes, and only needs to be completed once. There are two versions of the agreement:
Ace is a community project and wouldn't be what it is without contributions! We actively encourage and support contributions. The Ace source code is released under the BSD License. This license is very simple, and is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings!
1. [The Individual CLA](https://github.com/ajaxorg/ace/raw/master/doc/Contributor_License_Agreement-v2.pdf): use this version if you're working on an ajax.org in your spare time, or can clearly claim ownership of copyright in what you'll be submitting.
2. [The Corporate CLA](https://github.com/ajaxorg/ace/raw/master/doc/Corporate_Contributor_License_Agreement-v2.pdf): have your corporate lawyer review and submit this if your company is going to be contributing to ajax.org projects
Feel free to fork and improve/enhance Ace any way you want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. For more information on our contributing guidelines, see [CONTRIBUTING.md](https://github.com/ajaxorg/ace/blob/master/CONTRIBUTING.md).
If you want to contribute to an ajax.org project please print the CLA and fill it out and sign it. Then either send it by snail mail or fax to us or send it back scanned (or as a photo) by email.
Continuous Integration status
-----------------------------
Email: fabian.jakobs@web.de
This project is tested with [Travis CI](http://travis-ci.org)
<divid="ellipsis_Ace.createEditSession"class="ellipsis_description"><p>Creates a new <ahref="edit_session.html"class="link-short"title="EditSession (class)"data-id="EditSession"><code>EditSession</code></a>, and returns the associated <ahref="document.html"class="link-short"title="Document (class)"data-id="Document"><code>Document</code></a>.</p>
</div>
<divclass="description"><p>Creates a new <ahref="edit_session.html"class="link-short"title="EditSession (class)"data-id="EditSession"><code>EditSession</code></a>, and returns the associated <ahref="document.html"class="link-short"title="Document (class)"data-id="Document"><code>Document</code></a>.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">text</td><tdclass="argType""><ahref="document.html"class=""title="Document (class)"data-id="Document">Document</a> | <ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String"class=""title="String"data-id="String">String</a></td><tdclass="argDescription "><p>Required. If <code>text</code> is a <code>Document</code>, it associates the <code>EditSession</code> with it. Otherwise, a new <code>Document</code> is created, with the initial text</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">mode</td><tdclass="argType""><ahref="https://github.com/ajaxorg/ace/blob/master/lib/ace/mode/text.js"class=""title="TextMode"data-id="TextMode">TextMode</a></td><tdclass="argDescription "><p>Required. The inital language mode to use for the document</p>
<divid="ellipsis_Ace.edit"class="ellipsis_description"><p>Embeds the Ace editor into the DOM, at the element provided by <code>el</code>.</p>
</div>
<divclass="description"><p>Embeds the Ace editor into the DOM, at the element provided by <code>el</code>.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">el</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String"class=""title="String"data-id="String">String</a> | <ahref="https://developer.mozilla.org/en/DOM/element"class=""title="DOMElement"data-id="DOMElement">DOMElement</a></td><tdclass="argDescription "><p>Required. Either the id of an element, or the element itself</p>
<divclass="memberContent"><p>Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated.</p>
<divid="ellipsis_Anchor.new"class="ellipsis_description"><p>Creates a new <code>Anchor</code> and associates it with a document.</p>
</div>
<divclass="description"><p>Creates a new <code>Anchor</code> and associates it with a document.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">doc</td><tdclass="argType""><ahref="document.html"class=""title="Document (class)"data-id="Document">Document</a></td><tdclass="argDescription "><p>Required. The document to associate with the anchor</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The starting row position</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">column</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The starting column position</p>
<divid="ellipsis_Anchor.event.change"class="ellipsis_description"><p>Fires whenever the anchor position changes.</p>
</div>
<divclass="description"><p>Fires whenever the anchor position changes.</p>
<p>Both of these objects have a <code>row</code> and <code>column</code> property corresponding to the position.</p>
<p>Events that can trigger this function include <ahref="#Anchor.setPosition"class="link-short"title="Anchor.setPosition (class method)"data-id="Anchor.setPosition"><code>setPosition()</code></a>.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">e</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object"class=""title="Object"data-id="Object">Object</a></td><tdclass="argDescription "><p>Required. An object containing information about the anchor position. It has two properties: </p>
<ul>
<li><code>old</code>: An object describing the old Anchor position</li>
<li><code>value</code>: An object describing the new Anchor position</li>
<divid="ellipsis_Anchor.getPosition"class="ellipsis_description"><p>Returns an object identifying the <code>row</code> and <code>column</code> position of the current anchor.</p>
</div>
<divclass="description"><p>Returns an object identifying the <code>row</code> and <code>column</code> position of the current anchor.</p>
<divid="ellipsis_Anchor.setPosition"class="ellipsis_description"><p>Sets the anchor position to the specified row and column. If <code>noClip</code> is <code>true</code>, the position is not clipped.</p>
</div>
<divclass="description"><p>Sets the anchor position to the specified row and column. If <code>noClip</code> is <code>true</code>, the position is not clipped.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The row index to move the anchor to</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">column</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The column index to move the anchor to</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">noClip</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean"class=""title="Boolean"data-id="Boolean">Boolean</a></td><tdclass="argDescription "><p>Required. Identifies if you want the position to be clipped</p>
<divclass="memberContent"><p>Tokenizes the current <ahref="document.html"class="link-short"title="Document (class)"data-id="Document"><code>Document</code></a> in the background, and caches the tokenized rows for future use. </p>
<p>If a certain row is changed, everything below that row is re-tokenized.</p>
<divid="ellipsis_BackgroundTokenizer.new"class="ellipsis_description"><p>Creates a new <code>BackgroundTokenizer</code> object.</p>
</div>
<divclass="description"><p>Creates a new <code>BackgroundTokenizer</code> object.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">tokenizer</td><tdclass="argType""><ahref="tokenizer.html"class=""title="Tokenizer (class)"data-id="Tokenizer">Tokenizer</a></td><tdclass="argDescription "><p>Required. The tokenizer to use</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">editor</td><tdclass="argType""><ahref="editor.html"class=""title="Editor (class)"data-id="Editor">Editor</a></td><tdclass="argDescription "><p>Required. The editor to associate with</p>
<divid="ellipsis_BackgroundTokenizer.event.update"class="ellipsis_description"><p>Fires whenever the background tokeniziers between a range of rows are going to be updated.</p>
</div>
<divclass="description"><p>Fires whenever the background tokeniziers between a range of rows are going to be updated.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">e</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object"class=""title="Object"data-id="Object">Object</a></td><tdclass="argDescription "><p>Required. An object containing two properties, <code>first</code> and <code>last</code>, which indicate the rows of the region being updated.</p>
<divid="ellipsis_BackgroundTokenizer.fireUpdateEvent"class="ellipsis_description"><p>Emits the <code>'update'</code> event. <code>firstRow</code> and <code>lastRow</code> are used to define the boundaries of the region to be updated.</p>
</div>
<divclass="description"><p>Emits the <code>'update'</code> event. <code>firstRow</code> and <code>lastRow</code> are used to define the boundaries of the region to be updated.</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">lastRow</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The final row region</p>
<divid="ellipsis_BackgroundTokenizer.getState"class="ellipsis_description"><p>Returns the state of tokenization at the end of a row.</p>
</div>
<divclass="description"><p>Returns the state of tokenization at the end of a row.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The row to get state at</p>
<divid="ellipsis_BackgroundTokenizer.getTokens"class="ellipsis_description"><p>Gives list of tokens of the row. (tokens are cached)</p>
</div>
<divclass="description"><p>Gives list of tokens of the row. (tokens are cached)</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The row to get tokens at</p>
<divid="ellipsis_BackgroundTokenizer.setDocument"class="ellipsis_description"><p>Sets a new document to associate with this object.</p>
</div>
<divclass="description"><p>Sets a new document to associate with this object.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">doc</td><tdclass="argType""><ahref="document.html"class=""title="Document (class)"data-id="Document">Document</a></td><tdclass="argDescription "><p>Required. The new document to associate with</p>
<divid="ellipsis_BackgroundTokenizer.setTokenizer"class="ellipsis_description"><p>Sets a new tokenizer for this object.</p>
</div>
<divclass="description"><p>Sets a new tokenizer for this object.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">tokenizer</td><tdclass="argType""><ahref="tokenizer.html"class=""title="Tokenizer (class)"data-id="Tokenizer">Tokenizer</a></td><tdclass="argDescription "><p>Required. The new tokenizer to use</p>
<divclass="memberContent"><p>Contains the text of the document. Document can be attached to several <ahref="edit_session.html"class="link-short"title="EditSession (class)"data-id="EditSession"><code>EditSession</code></a>s. </p>
<p>At its core, <code>Document</code>s are just an array of strings, with each row in the document matching up to the array index.</p>
<divid="ellipsis_Document.new"class="ellipsis_description"><p>Creates a new <code>Document</code>. If <code>text</code> is included, the <code>Document</code> contains those strings; otherwise, it's empty.</p>
</div>
<divclass="description"><p>Creates a new <code>Document</code>. If <code>text</code> is included, the <code>Document</code> contains those strings; otherwise, it's empty.</p>
<divid="ellipsis_Document.event.change"class="ellipsis_description"><p>Fires whenever the document changes.</p>
</div>
<divclass="description"><p>Fires whenever the document changes.</p>
<p>Several methods trigger different <code>"change"</code> events. Below is a list of each action type, followed by each property that's also available:</p>
<ul>
<li><code>"insertLines"</code> (emitted by <ahref="#Document.insertLines"class="link-short"title="Document.insertLines (class method)"data-id="Document.insertLines"><code>Document.insertLines()</code></a>)</li>
<li><code>range</code>: the <ahref="range.html"class="link-short"title="Range (class)"data-id="Range"><code>Range</code></a> of the change within the document</li>
<li><code>lines</code>: the lines in the document that are changing</li>
<li><code>"insertText"</code> (emitted by <ahref="#Document.insertNewLine"class="link-short"title="Document.insertNewLine (class method)"data-id="Document.insertNewLine"><code>Document.insertNewLine()</code></a>)</li>
<li><code>range</code>: the <ahref="range.html"class="link-short"title="Range (class)"data-id="Range"><code>Range</code></a> of the change within the document</li>
<li><code>text</code>: the text that's being added</li>
<li><code>"removeLines"</code> (emitted by <ahref="#Document.insertLines"class="link-short"title="Document.insertLines (class method)"data-id="Document.insertLines"><code>Document.insertLines()</code></a>)</li>
<li><code>range</code>: the <ahref="range.html"class="link-short"title="Range (class)"data-id="Range"><code>Range</code></a> of the change within the document</li>
<li><code>lines</code>: the lines in the document that were removed</li>
<li><code>nl</code>: the new line character (as defined by <ahref="#Document.getNewLineCharacter"class="link-short"title="Document.getNewLineCharacter (class method)"data-id="Document.getNewLineCharacter"><code>Document.getNewLineCharacter()</code></a>)</li>
<li><code>"removeText"</code> (emitted by <ahref="#Document.removeInLine"class="link-short"title="Document.removeInLine (class method)"data-id="Document.removeInLine"><code>Document.removeInLine()</code></a> and <ahref="#Document.removeNewLine"class="link-short"title="Document.removeNewLine (class method)"data-id="Document.removeNewLine"><code>Document.removeNewLine()</code></a>)</li>
<li><code>range</code>: the <ahref="range.html"class="link-short"title="Range (class)"data-id="Range"><code>Range</code></a> of the change within the document</li>
<li><code>text</code>: the text that's being removed</li>
</ul>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">e</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object"class=""title="Object"data-id="Object">Object</a></td><tdclass="argDescription "><p>Required. Contains at least one property called <code>"action"</code>. <code>"action"</code> indicates the action that triggered the change. Each action also has a set of additional properties.</p>
<divid="ellipsis_Document.applyDeltas"class="ellipsis_description"><p>Applies all the changes previously accumulated. These can be either <code>'includeText'</code>, <code>'insertLines'</code>, <code>'removeText'</code>, and <code>'removeLines'</code>.</p>
</div>
<divclass="description"><p>Applies all the changes previously accumulated. These can be either <code>'includeText'</code>, <code>'insertLines'</code>, <code>'removeText'</code>, and <code>'removeLines'</code>.</p>
<divid="ellipsis_Document.createAnchor"class="ellipsis_description"><p>Creates a new <code>Anchor</code> to define a floating point in the document.</p>
</div>
<divclass="description"><p>Creates a new <code>Anchor</code> to define a floating point in the document.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The row number to use</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">column</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The column number to use</p>
<divid="ellipsis_Document.getLine"class="ellipsis_description"><p>Returns a verbatim copy of the given line as it is in the document</p>
</div>
<divclass="description"><p>Returns a verbatim copy of the given line as it is in the document</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The row index to retrieve</p>
<divid="ellipsis_Document.getLines"class="ellipsis_description"><p>Returns an array of strings of the rows between <code>firstRow</code> and <code>lastRow</code>. This function is inclusive of <code>lastRow</code>.</p>
</div>
<divclass="description"><p>Returns an array of strings of the rows between <code>firstRow</code> and <code>lastRow</code>. This function is inclusive of <code>lastRow</code>.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">firstRow</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The first row index to retrieve</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">lastRow</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The final row index to retrieve</p>
<divid="ellipsis_Document.getNewLineCharacter"class="ellipsis_description"><p>Returns the newline character that's being used, depending on the value of <code>newLineMode</code>.</p>
</div>
<divclass="description"><p>Returns the newline character that's being used, depending on the value of <code>newLineMode</code>.</p>
<divid="ellipsis_Document.getNewLineMode"class="ellipsis_description"><p>Returns the type of newlines being used; either <code>windows</code>, <code>unix</code>, or <code>auto</code></p>
</div>
<divclass="description"><p>Returns the type of newlines being used; either <code>windows</code>, <code>unix</code>, or <code>auto</code></p>
<divid="ellipsis_Document.getTextRange"class="ellipsis_description"><p>Given a range within the document, this function returns all the text within that range as a single string.</p>
</div>
<divclass="description"><p>Given a range within the document, this function returns all the text within that range as a single string.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">range</td><tdclass="argType""><ahref="range.html"class=""title="Range (class)"data-id="Range">Range</a></td><tdclass="argDescription "><p>Required. The range to work with</p>
<divid="ellipsis_Document.getValue"class="ellipsis_description"><p>Returns all the lines in the document as a single string, split by the new line character.</p>
</div>
<divclass="description"><p>Returns all the lines in the document as a single string, split by the new line character.</p>
<divid="ellipsis_Document.indexToPosition"class="ellipsis_description"><p>Converts an index position in a document to a <code>{row, column}</code> object.</p>
</div>
<divclass="description"><p>Converts an index position in a document to a <code>{row, column}</code> object.</p>
<p>Index refers to the "absolute position" of a character in the document. For example:</p>
<pre><codeclass="language-javascript"><spanclass="keyword">var</span> x = <spanclass="number">0</span>; <spanclass="comment">// 10 characters, plus one for newline</span>
<spanclass="keyword">var</span> y = -<spanclass="number">1</span>;</code></pre>
<p>Here, <code>y</code> is an index 15: 11 characters for the first row, and 5 characters until <code>y</code> in the second.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">index</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. An index to convert</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">startRow</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. =0 The row from which to start the conversion</p>
<divid="ellipsis_Document.insert"class="ellipsis_description"><p>Inserts a block of <code>text</code> and the indicated <code>position</code>.</p>
</div>
<divclass="description"><p>Inserts a block of <code>text</code> and the indicated <code>position</code>.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">position</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object"class=""title="Object"data-id="Object">Object</a></td><tdclass="argDescription "><p>Required. The position to start inserting at</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">text</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String"class=""title="String"data-id="String">String</a></td><tdclass="argDescription "><p>Required. A chunk of text to insert</p>
<divid="ellipsis_Document.insertInLine"class="ellipsis_description"><p>Inserts <code>text</code> into the <code>position</code> at the current row. This method also triggers the <code>'change'</code> event.</p>
</div>
<divclass="description"><p>Inserts <code>text</code> into the <code>position</code> at the current row. This method also triggers the <code>'change'</code> event.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">position</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object"class=""title="Object"data-id="Object">Object</a></td><tdclass="argDescription "><p>Required. The position to insert at</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">text</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String"class=""title="String"data-id="String">String</a></td><tdclass="argDescription "><p>Required. A chunk of text</p>
<divid="ellipsis_Document.insertLines"class="ellipsis_description"><p>Inserts the elements in <code>lines</code> into the document, starting at the row index given by <code>row</code>. This method also triggers the <code>'change'</code> event.</p>
</div>
<divclass="description"><p>Inserts the elements in <code>lines</code> into the document, starting at the row index given by <code>row</code>. This method also triggers the <code>'change'</code> event.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The index of the row to insert at</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">lines</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array"class=""title="Array"data-id="Array">Array</a></td><tdclass="argDescription "><p>Required. An array of strings</p>
<divid="ellipsis_Document.insertNewLine"class="ellipsis_description"><p>Inserts a new line into the document at the current row's <code>position</code>. This method also triggers the <code>'change'</code> event.</p>
</div>
<divclass="description"><p>Inserts a new line into the document at the current row's <code>position</code>. This method also triggers the <code>'change'</code> event.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">position</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object"class=""title="Object"data-id="Object">Object</a></td><tdclass="argDescription "><p>Required. The position to insert at</p>
<divid="ellipsis_Document.isNewLine"class="ellipsis_description"><p>Returns <code>true</code> if <code>text</code> is a newline character (either <code>\r\n</code>, <code>\r</code>, or <code>\n</code>).</p>
</div>
<divclass="description"><p>Returns <code>true</code> if <code>text</code> is a newline character (either <code>\r\n</code>, <code>\r</code>, or <code>\n</code>).</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">text</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String"class=""title="String"data-id="String">String</a></td><tdclass="argDescription "><p>Required. The text to check</p>
<divid="ellipsis_Document.positionToIndex"class="ellipsis_description"><p>Converts the <code>{row, column}</code> position in a document to the character's index.</p>
</div>
<divclass="description"><p>Converts the <code>{row, column}</code> position in a document to the character's index.</p>
<p>Index refers to the "absolute position" of a character in the document. For example:</p>
<pre><codeclass="language-javascript"><spanclass="keyword">var</span> x = <spanclass="number">0</span>; <spanclass="comment">// 10 characters, plus one for newline</span>
<spanclass="keyword">var</span> y = -<spanclass="number">1</span>;</code></pre>
<p>Here, <code>y</code> is an index 15: 11 characters for the first row, and 5 characters until <code>y</code> in the second.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">pos</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object"class=""title="Object"data-id="Object">Object</a></td><tdclass="argDescription "><p>Required. The <code>{row, column}</code> to convert</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">startRow</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. =0 The row from which to start the conversion</p>
<divid="ellipsis_Document.remove"class="ellipsis_description"><p>Removes the <code>range</code> from the document.</p>
</div>
<divclass="description"><p>Removes the <code>range</code> from the document.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">range</td><tdclass="argType""><ahref="range.html"class=""title="Range (class)"data-id="Range">Range</a></td><tdclass="argDescription "><p>Required. A specified Range to remove</p>
<divid="ellipsis_Document.removeInLine"class="ellipsis_description"><p>Removes the specified columns from the <code>row</code>. This method also triggers the <code>'change'</code> event.</p>
</div>
<divclass="description"><p>Removes the specified columns from the <code>row</code>. This method also triggers the <code>'change'</code> event.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The row to remove from</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">startColumn</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The column to start removing at</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">endColumn</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The column to stop removing at</p>
<divid="ellipsis_Document.removeLines"class="ellipsis_description"><p>Removes a range of full lines. This method also triggers the <code>'change'</code> event.</p>
</div>
<divclass="description"><p>Removes a range of full lines. This method also triggers the <code>'change'</code> event.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">firstRow</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The first row to be removed</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">lastRow</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The last row to be removed</p>
<divid="ellipsis_Document.removeNewLine"class="ellipsis_description"><p>Removes the new line between <code>row</code> and the row immediately following it. This method also triggers the <code>'change'</code> event.</p>
</div>
<divclass="description"><p>Removes the new line between <code>row</code> and the row immediately following it. This method also triggers the <code>'change'</code> event.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The row to check</p>
<divid="ellipsis_Document.replace"class="ellipsis_description"><p>Replaces a range in the document with the new <code>text</code>.</p>
</div>
<divclass="description"><p>Replaces a range in the document with the new <code>text</code>.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">range</td><tdclass="argType""><ahref="range.html"class=""title="Range (class)"data-id="Range">Range</a></td><tdclass="argDescription "><p>Required. A specified Range to replace</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">text</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String"class=""title="String"data-id="String">String</a></td><tdclass="argDescription "><p>Required. The new text to use as a replacement</p>
<divid="ellipsis_Document.revertDeltas"class="ellipsis_description"><p>Reverts any changes previously applied. These can be either <code>'includeText'</code>, <code>'insertLines'</code>, <code>'removeText'</code>, and <code>'removeLines'</code>.</p>
</div>
<divclass="description"><p>Reverts any changes previously applied. These can be either <code>'includeText'</code>, <code>'insertLines'</code>, <code>'removeText'</code>, and <code>'removeLines'</code>.</p>
<divid="ellipsis_Document.setNewLineMode"class="ellipsis_description"><p>Sets the new line mode.</p>
</div>
<divclass="description"><p>Sets the new line mode.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">newLineMode</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String"class=""title="String"data-id="String">String</a></td><tdclass="argDescription "><p>Required. The newline mode to use; can be either <code>windows</code>, <code>unix</code>, or <code>auto</code></p>
<divid="ellipsis_Document.setValue"class="ellipsis_description"><p>Replaces all the lines in the current <code>Document</code> with the value of <code>text</code>.</p>
</div>
<divclass="description"><p>Replaces all the lines in the current <code>Document</code> with the value of <code>text</code>.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">text</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String"class=""title="String"data-id="String">String</a></td><tdclass="argDescription "><p>Required. The text to use</p>
<divid="documentation"class="span9"><h1>Ace API Reference</h1>
<p>Welcome to the Ace API Reference Guide. Ace is a standalone code editor written in JavaScript that you can embed onto any website. We're used in a bunch of places already, like GitHub, Google, and Facebook.</p>
<p>On the left, you'll find a list of all of our currently documented classes. There are plenty more to do, but these represent the "core" set. For more information on how to work with Ace, check out the <ahref="http://ace.ajax.org">main Ace website</a>.</p>
<p>Hides all over markers in the <ahref="edit_session.html"class="link-short"title="EditSession (class)"data-id="EditSession"><code>EditSession</code></a> that are not the currently selected one.</p>
<divclass="memberContent"><p>This object is used in various places to indicate a region within the editor. To better visualize how this works, imagine a rectangle. Each quadrant of the rectangle is analogus to a range, as ranges contain a starting row and starting column, and an ending row, and ending column.</p>
<divid="ellipsis_Range.new"class="ellipsis_description"><p>Creates a new <code>Range</code> object with the given starting and ending row and column points.</p>
</div>
<divclass="description"><p>Creates a new <code>Range</code> object with the given starting and ending row and column points.</p>
<divid="ellipsis_Range.clipRows"class="ellipsis_description"><p>Returns the part of the current <code>Range</code> that occurs within the boundaries of <code>firstRow</code> and <code>lastRow</code> as a new <code>Range</code> object.</p>
</div>
<divclass="description"><p>Returns the part of the current <code>Range</code> that occurs within the boundaries of <code>firstRow</code> and <code>lastRow</code> as a new <code>Range</code> object.</p>
<divid="ellipsis_Range.collapseRows"class="ellipsis_description"><p>Returns a range containing the starting and ending rows of the original range, but with a column value of <code>0</code>.</p>
</div>
<divclass="description"><p>Returns a range containing the starting and ending rows of the original range, but with a column value of <code>0</code>.</p>
<divid="ellipsis_Range.compare"class="ellipsis_description"><p>Checks the row and column points with the row and column points of the calling range.</p>
</div>
<divclass="description"><p>Checks the row and column points with the row and column points of the calling range.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A row point to compare with</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">column</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A column point to compare with</p>
<divid="ellipsis_Range.compareEnd"class="ellipsis_description"><p>Checks the row and column points with the row and column points of the calling range.</p>
</div>
<divclass="description"><p>Checks the row and column points with the row and column points of the calling range.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A row point to compare with</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">column</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A column point to compare with</p>
<divid="ellipsis_Range.compareInside"class="ellipsis_description"><p>Checks the row and column points with the row and column points of the calling range.</p>
</div>
<divclass="description"><p>Checks the row and column points with the row and column points of the calling range.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A row point to compare with</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">column</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A column point to compare with</p>
<divid="ellipsis_Range.comparePoint"class="ellipsis_description"><p>Checks the row and column points of <code>p</code> with the row and column points of the calling range.</p>
</div>
<divclass="description"><p>Checks the row and column points of <code>p</code> with the row and column points of the calling range.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">p</td><tdclass="argType""><ahref="range.html"class=""title="Range (class)"data-id="Range">Range</a></td><tdclass="argDescription "><p>Required. A point to compare with</p>
<divid="ellipsis_Range.compareRange"class="ellipsis_description"><p>Compares <code>this</code> range (A) with another range (B).</p>
</div>
<divclass="description"><p>Compares <code>this</code> range (A) with another range (B).</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">range</td><tdclass="argType""><ahref="range.html"class=""title="Range (class)"data-id="Range">Range</a></td><tdclass="argDescription "><p>Required. A range to compare with</p>
<divid="ellipsis_Range.compareStart"class="ellipsis_description"><p>Checks the row and column points with the row and column points of the calling range.</p>
</div>
<divclass="description"><p>Checks the row and column points with the row and column points of the calling range.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A row point to compare with</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">column</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A column point to compare with</p>
<divid="ellipsis_Range.contains"class="ellipsis_description"><p>Returns <code>true</code> if the <code>row</code> and <code>column</code> provided are within the given range. This can better be expressed as returning <code>true</code> if:</p>
<divclass="description"><p>Returns <code>true</code> if the <code>row</code> and <code>column</code> provided are within the given range. This can better be expressed as returning <code>true</code> if:</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A row to check for</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">column</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A column to check for</p>
<divid="ellipsis_Range.containsRange"class="ellipsis_description"><p>Checks the start and end points of <code>range</code> and compares them to the calling range. Returns <code>true</code> if the <code>range</code> is contained within the caller's range.</p>
</div>
<divclass="description"><p>Checks the start and end points of <code>range</code> and compares them to the calling range. Returns <code>true</code> if the <code>range</code> is contained within the caller's range.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">range</td><tdclass="argType""><ahref="range.html"class=""title="Range (class)"data-id="Range">Range</a></td><tdclass="argDescription "><p>Required. A range to compare with</p>
<divid="ellipsis_Range.extend"class="ellipsis_description"><p>Changes the row and column points for the calling range for both the starting and ending points.</p>
</div>
<divclass="description"><p>Changes the row and column points for the calling range for both the starting and ending points.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A new row to extend to</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">column</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A new column to extend to</p>
<divid="ellipsis_Range.fromPoints"class="ellipsis_description"><p>Creates and returns a new <code>Range</code> based on the row and column of the given parameters.</p>
</div>
<divclass="description"><p>Creates and returns a new <code>Range</code> based on the row and column of the given parameters.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">start</td><tdclass="argType""><ahref="range.html"class=""title="Range (class)"data-id="Range">Range</a></td><tdclass="argDescription "><p>Required. A starting point to use</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">end</td><tdclass="argType""><ahref="range.html"class=""title="Range (class)"data-id="Range">Range</a></td><tdclass="argDescription "><p>Required. An ending point to use</p>
<divid="ellipsis_Range.inside"class="ellipsis_description"><p>Returns <code>true</code> if the <code>row</code> and <code>column</code> are within the given range.</p>
</div>
<divclass="description"><p>Returns <code>true</code> if the <code>row</code> and <code>column</code> are within the given range.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A row point to compare with</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">column</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A column point to compare with</p>
<divid="ellipsis_Range.insideEnd"class="ellipsis_description"><p>Returns <code>true</code> if the <code>row</code> and <code>column</code> are within the given range's ending points.</p>
</div>
<divclass="description"><p>Returns <code>true</code> if the <code>row</code> and <code>column</code> are within the given range's ending points.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A row point to compare with</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">column</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A column point to compare with</p>
<divid="ellipsis_Range.insideStart"class="ellipsis_description"><p>Returns <code>true</code> if the <code>row</code> and <code>column</code> are within the given range's starting points.</p>
</div>
<divclass="description"><p>Returns <code>true</code> if the <code>row</code> and <code>column</code> are within the given range's starting points.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A row point to compare with</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">column</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A column point to compare with</p>
<divid="ellipsis_Range.intersects"class="ellipsis_description"><p>Returns <code>true</code> if passed in <code>range</code> intersects with the one calling this method.</p>
</div>
<divclass="description"><p>Returns <code>true</code> if passed in <code>range</code> intersects with the one calling this method.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">range</td><tdclass="argType""><ahref="range.html"class=""title="Range (class)"data-id="Range">Range</a></td><tdclass="argDescription "><p>Required. A range to compare with</p>
<divid="ellipsis_Range.isEnd"class="ellipsis_description"><p>Returns <code>true</code> if the caller's ending row point is the same as <code>row</code>, and if the caller's ending column is the same as <code>column</code>.</p>
</div>
<divclass="description"><p>Returns <code>true</code> if the caller's ending row point is the same as <code>row</code>, and if the caller's ending column is the same as <code>column</code>.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A row point to compare with</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">column</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A column point to compare with</p>
<divid="ellipsis_Range.isEqual"class="ellipsis_description"><p>Returns <code>true</code> if and only if the starting row and column, and ending row and column, are equivalent to those given by <code>range</code>.</p>
</div>
<divclass="description"><p>Returns <code>true</code> if and only if the starting row and column, and ending row and column, are equivalent to those given by <code>range</code>.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">range</td><tdclass="argType""><ahref="range.html"class=""title="Range (class)"data-id="Range">Range</a></td><tdclass="argDescription "><p>Required. A range to check against</p>
<divid="ellipsis_Range.isStart"class="ellipsis_description"><p>Returns <code>true</code> if the caller's starting row point is the same as <code>row</code>, and if the caller's starting column is the same as <code>column</code>.</p>
</div>
<divclass="description"><p>Returns <code>true</code> if the caller's starting row point is the same as <code>row</code>, and if the caller's starting column is the same as <code>column</code>.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A row point to compare with</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">column</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A column point to compare with</p>
<divid="ellipsis_Range.setEnd"class="ellipsis_description"><p>Sets the starting row and column for the range.</p>
</div>
<divclass="description"><p>Sets the starting row and column for the range.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A row point to set</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">column</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A column point to set</p>
<divid="ellipsis_Range.setStart"class="ellipsis_description"><p>Sets the starting row and column for the range.</p>
</div>
<divclass="description"><p>Sets the starting row and column for the range.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A row point to set</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">column</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. A column point to set</p>
<divid="ellipsis_Range.toScreenRange"class="ellipsis_description"><p>Given the current <code>Range</code>, this function converts those starting and ending points into screen positions, and then returns a new <code>Range</code> object.</p>
</div>
<divclass="description"><p>Given the current <code>Range</code>, this function converts those starting and ending points into screen positions, and then returns a new <code>Range</code> object.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">session</td><tdclass="argType""><ahref="edit_session.html"class=""title="EditSession (class)"data-id="EditSession">EditSession</a></td><tdclass="argDescription "><p>Required. The <code>EditSession</code> to retrieve coordinates from</p>
<divid="ellipsis_Range.toString"class="ellipsis_description"><p>Returns a string containing the range's row and column information, given like this:</p>
m);varr=s.createElement("OL");r.className="linenums";for(varn=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}functionk(a,m){for(vare=m.length;--e>=0;){varh=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}functionC(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";returnA[a]}functionE(a){varm=
<divid="ellipsis_ScrollBar.new"class="ellipsis_description"><p>Creates a new <code>ScrollBar</code>. <code>parent</code> is the owner of the scroll bar.</p>
</div>
<divclass="description"><p>Creates a new <code>ScrollBar</code>. <code>parent</code> is the owner of the scroll bar.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">parent</td><tdclass="argType""><ahref="https://developer.mozilla.org/en/DOM/element"class=""title="DOMElement"data-id="DOMElement">DOMElement</a></td><tdclass="argDescription "><p>Required. A DOM element</p>
<divid="ellipsis_ScrollBar.event.scroll"class="ellipsis_description"><p>Emitted when the scroll bar, well, scrolls.</p>
</div>
<divclass="description"><p>Emitted when the scroll bar, well, scrolls.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">e</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object"class=""title="Object"data-id="Object">Object</a></td><tdclass="argDescription "><p>Required. Contains one property, <code>"data"</code>, which indicates the current scroll top position</p>
<divclass="memberContent"><p>A class designed to handle all sorts of text searches within a <ahref="document.html"class="link-short"title="Document (class)"data-id="Document"><code>Document</code></a>.</p>
<divid="ellipsis_Search.new"class="ellipsis_description"><p>Creates a new <code>Search</code> object. The following search options are avaliable:</p>
</div>
<divclass="description"><p>Creates a new <code>Search</code> object. The following search options are avaliable:</p>
<ul>
<li><code>needle</code>: The string or regular expression you're looking for</li>
<li><code>backwards</code>: Whether to search backwards from where cursor currently is. Defaults to <code>false</code>.</li>
<li><code>wrap</code>: Whether to wrap the search back to the beginning when it hits the end. Defaults to <code>false</code>.</li>
<li><code>caseSensitive</code>: Whether the search ought to be case-sensitive. Defaults to <code>false</code>.</li>
<li><code>wholeWord</code>: Whether the search matches only on whole words. Defaults to <code>false</code>.</li>
<li><code>range</code>: The <ahref="range.html"class="link-short"title="Range (class)"data-id="Range"><code>Range</code></a> to search within. Set this to <code>null</code> for the whole document</li>
<li><code>regExp</code>: Whether the search is a regular expression or not. Defaults to <code>false</code>.</li>
<li><code>start</code>: The starting <ahref="range.html"class="link-short"title="Range (class)"data-id="Range"><code>Range</code></a> or cursor position to begin the search</li>
<li><code>skipCurrent</code>: Whether or not to include the current line in the search. Default to <code>false</code>.</li>
<divid="ellipsis_Search.find"class="ellipsis_description"><p>Searches for <code>options.needle</code>. If found, this method returns the <ahref="range.html"class="link-short"title="Range (class)"data-id="Range"><code>Range</code></a> where the text first occurs. If <code>options.backwards</code> is <code>true</code>, the search goes backwards in the session.</p>
</div>
<divclass="description"><p>Searches for <code>options.needle</code>. If found, this method returns the <ahref="range.html"class="link-short"title="Range (class)"data-id="Range"><code>Range</code></a> where the text first occurs. If <code>options.backwards</code> is <code>true</code>, the search goes backwards in the session.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">session</td><tdclass="argType""><ahref="edit_session.html"class=""title="EditSession (class)"data-id="EditSession">EditSession</a></td><tdclass="argDescription "><p>Required. The session to search with</p>
<divid="ellipsis_Search.findAll"class="ellipsis_description"><p>Searches for all occurances <code>options.needle</code>. If found, this method returns an array of <ahref="range.html"class="link-short"title="Range (class)"data-id="Range"><code>Range</code>s</a> where the text first occurs. If <code>options.backwards</code> is <code>true</code>, the search goes backwards in the session.</p>
</div>
<divclass="description"><p>Searches for all occurances <code>options.needle</code>. If found, this method returns an array of <ahref="range.html"class="link-short"title="Range (class)"data-id="Range"><code>Range</code>s</a> where the text first occurs. If <code>options.backwards</code> is <code>true</code>, the search goes backwards in the session.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">session</td><tdclass="argType""><ahref="edit_session.html"class=""title="EditSession (class)"data-id="EditSession">EditSession</a></td><tdclass="argDescription "><p>Required. The session to search with</p>
<divid="ellipsis_Search.replace"class="ellipsis_description"><p>Searches for <code>options.needle</code> in <code>input</code>, and, if found, replaces it with <code>replacement</code>.</p>
</div>
<divclass="description"><p>Searches for <code>options.needle</code> in <code>input</code>, and, if found, replaces it with <code>replacement</code>.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">input</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String"class=""title="String"data-id="String">String</a></td><tdclass="argDescription "><p>Required. The text to search in</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">replacement</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String"class=""title="String"data-id="String">String</a></td><tdclass="argDescription "><p>Required. The replacing text</p>
<ul>
<li>(String): If <code>options.regExp</code> is <code>true</code>, this function returns <code>input</code> with the replacement already made. Otherwise, this function just returns <code>replacement</code>.<br/>
If <code>options.needle</code> was not found, this function returns <code>null</code>.</li>
<divid="ellipsis_Search.set"class="ellipsis_description"><p>Sets the search options via the <code>options</code> parameter.</p>
</div>
<divclass="description"><p>Sets the search options via the <code>options</code> parameter.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">options</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object"class=""title="Object"data-id="Object">Object</a></td><tdclass="argDescription "><p>Required. An object containing all the new search properties</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">callback</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function"class=""title="Function"data-id="Function">Function</a></td><tdclass="argDescription "><p>Required. A callback function to execute</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">scope</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String"class=""title="String"data-id="String">String</a></td><tdclass="argDescription "><p>Required. The default scope for the callback</p>
<p>Executes <code>callback</code> on all of the available editors.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">idx</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The index of the editor you want</p>
<p>Returns the editor identified by the index <code>idx</code>.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">size</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The new font size</p>
<p>Sets the font size, in pixels, for all the available editors.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">keybinding</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String"class=""title="String"data-id="String">String</a></td><tdclass="argDescription "><p>Required. Sets the keyboard handler for the editor.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">session</td><tdclass="argType""><ahref="edit_session.html"class=""title="EditSession (class)"data-id="EditSession">EditSession</a></td><tdclass="argDescription "><p>Required. The new edit session</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">idx</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The editor's index you're interested in</p>
<p>Sets a new <ahref="edit_session.html"class="link-short"title="EditSession (class)"data-id="EditSession"><code>EditSession</code></a> for the indicated editor.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">theme</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String"class=""title="String"data-id="String">String</a></td><tdclass="argDescription "><p>Required. The name of the theme to set</p>
<p>Sets a theme for each of the available editors.</p>
<divclass="memberContent"><p>This class provides an essay way to treat the document as a stream of tokens, and provides methods to iterate over these tokens.</p>
<divid="ellipsis_TokenIterator.new"class="ellipsis_description"><p>Creates a new token iterator object. The inital token index is set to the provided row and column coordinates.</p>
</div>
<divclass="description"><p>Creates a new token iterator object. The inital token index is set to the provided row and column coordinates.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">session</td><tdclass="argType""><ahref="edit_session.html"class=""title="EditSession (class)"data-id="EditSession">EditSession</a></td><tdclass="argDescription "><p>Required. The session to associate with</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">initialRow</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The row to start the tokenizing at</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">initialColumn</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription "><p>Required. The column to start the tokenizing at</p>
<divid="ellipsis_TokenIterator.stepBackward"class="ellipsis_description"><p>Tokenizes all the items from the current point to the row prior in the document.</p>
</div>
<divclass="description"><p>Tokenizes all the items from the current point to the row prior in the document.</p>
<divid="ellipsis_TokenIterator.stepForward"class="ellipsis_description"><p>Tokenizes all the items from the current point until the next row in the document. If the current point is at the end of the file, this function returns <code>null</code>. Otherwise, it returns the tokenized string.</p>
</div>
<divclass="description"><p>Tokenizes all the items from the current point until the next row in the document. If the current point is at the end of the file, this function returns <code>null</code>. Otherwise, it returns the tokenized string.</p>
<divclass="memberContent"><p>This class takes a set of highlighting rules, and creates a tokenizer out of them. For more information, see <ahref="https://github.com/ajaxorg/ace/wiki/Creating-or-Extending-an-Edit-Mode#wiki-extendingTheHighlighter">the wiki on extending highlighters</a>.</p>
</td></tr><trclass="argumentRow "><tdclass="argName ">flag</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String"class=""title="String"data-id="String">String</a></td><tdclass="argDescription "><p>Required. Any additional regular expression flags to pass (like "i" for case insensitive)</p>
<divid="ellipsis_Tokenizer.getLineTokens"class="ellipsis_description"><p>Returns an object containing two properties: <code>tokens</code>, which contains all the tokens; and <code>state</code>, the current state.</p>
</div>
<divclass="description"><p>Returns an object containing two properties: <code>tokens</code>, which contains all the tokens; and <code>state</code>, the current state.</p>
<divclass="memberContent"><p>This object maintains the undo stack for an <ahref="edit_session.html"class="link-short"title="EditSession (class)"data-id="EditSession"><code>EditSession</code></a>.</p>
<divid="ellipsis_UndoManager.execute"class="ellipsis_description"><p>Provides a means for implementing your own undo manager. <code>options</code> has one property, <code>args</code>, an <ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array"class="link-short"title="<code>Array</code>"data-id="<code>Array</code>"><code>Array</code></a>, with two elements:</p>
</div>
<divclass="description"><p>Provides a means for implementing your own undo manager. <code>options</code> has one property, <code>args</code>, an <ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array"class="link-short"title="<code>Array</code>"data-id="<code>Array</code>"><code>Array</code></a>, with two elements:</p>
<ul>
<li><code>args[0]</code> is an array of deltas</li>
<li><code>args[1]</code> is the document to associate with</li>
<divid="ellipsis_UndoManager.redo"class="ellipsis_description"><p>Perform a redo operation on the document, reimplementing the last change.</p>
</div>
<divclass="description"><p>Perform a redo operation on the document, reimplementing the last change.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">dontSelect</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean"class=""title="Boolean"data-id="Boolean">Boolean</a></td><tdclass="argDescription "><p>Required. If <code>true</code>, doesn't select the range of where the change occured</p>
<divid="ellipsis_UndoManager.undo"class="ellipsis_description"><p>Perform an undo operation on the document, reverting the last change.</p>
</div>
<divclass="description"><p>Perform an undo operation on the document, reverting the last change.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">dontSelect</td><tdclass="argType""><ahref="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean"class=""title="Boolean"data-id="Boolean">Boolean</a></td><tdclass="argDescription "><p>Required. If <code>true</code>, doesn't select the range of where the change occured</p>
Ace is a standalone code editor written in JavaScript. Our goal is to create a browser based editor that matches and extends the features, usability and performance of existing native editors such as TextMate, Vim or Eclipse. It can be easily embedded in any web page or JavaScript application. Ace is developed as the primary editor for [Cloud9 IDE](http://www.cloud9ide.com/) and the successor of the Mozilla Skywriter (Bespin) Project.
Features
--------
* Syntax highlighting
* Automatic indent and outdent
* An optional command line
* Handles huge documents (100,000 lines and more are no problem)
* Fully customizable key bindings including VI and Emacs modes
* Themes (TextMate themes can be imported)
* Search and replace with regular expressions
* Highlight matching parentheses
* Toggle between soft tabs and real tabs
* Displays hidden characters
* Drag and drop text using the mouse
* Line wrapping
* Unstructured / user code folding
* Live syntax checker (currently JavaScript/CoffeeScript)
Take Ace for a spin!
--------------------
Check out the Ace live [demo](http://ajaxorg.github.com/ace/) or get a [Cloud9 IDE account](http://run.cloud9ide.com) to experience Ace while editing one of your own GitHub projects.
If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookmarklet](http://ajaxorg.github.com/ace/build/textarea/editor.html).
History
-------
Previously known as “Bespin” and “Skywriter” it’s now known as Ace (Ajax.org Cloud9 Editor)! Bespin and Ace started as two independent projects, both aiming to build a no-compromise code editor component for the web. Bespin started as part of Mozilla Labs and was based on the canvas tag, while Ace is the Editor component of the Cloud9 IDE and is using the DOM for rendering. After the release of Ace at JSConf.eu 2010 in Berlin the Skywriter team decided to merge Ace with a simplified version of Skywriter's plugin system and some of Skywriter's extensibility points. All these changes have been merged back to Ace. Both Ajax.org and Mozilla are actively developing and maintaining Ace.
Getting the code
----------------
Ace is a community project. We actively encourage and support contributions. The Ace source code is hosted on GitHub. It is released under the Mozilla tri-license (MPL/GPL/LGPL), the same license used by Firefox. This license is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings!
```bash
git clone git://github.com/ajaxorg/ace.git
cd ace
git submodule update --init --recursive
```
Embedding Ace
-------------
Ace can be easily embedded into any existing web page. The Ace git repository ships with a pre-packaged version of Ace inside of the `build` directory. The same packaged files are also available as a separate [download](https://github.com/ajaxorg/ace/downloads). Simply copy the contents of the `src` subdirectory somewhere into your project and take a look at the included demos of how to use Ace.
With "editor" being the id of the DOM element, which should be converted to an editor. Note that this element must be explicitly sized and positioned `absolute` or `relative` for Ace to work. e.g.
```css
#editor {
position: absolute;
width: 500px;
height: 400px;
}
```
To change the theme simply include the Theme's JavaScript file
By default the editor only supports plain text mode; many other languages are available as separate modules. After including the mode's JavaScript file:
You find a lot more sample code in the [demo app](https://github.com/ajaxorg/ace/blob/master/demo/demo.js).
There is also some documentation on the [wiki page](https://github.com/ajaxorg/ace/wiki).
If you still need help, feel free to drop a mail on the [ace mailing list](http://groups.google.com/group/ace-discuss).
Running Ace
-----------
After the checkout Ace works out of the box. No build step is required. Open 'editor.html' in any browser except Google Chrome. Google Chrome doesn't allow XMLHTTPRequests from files loaded from disc (i.e. with a file:/// URL). To open Ace in Chrome simply start the bundled mini HTTP server:
```bash
./static.py
```
Or using Node.JS
```bash
./static.js
```
The editor can then be opened at http://localhost:8888/index.html.
Package Ace
-----------
To package Ace we use the dryice build tool developed by the Mozilla Skywriter team. Before you can build you need to make sure that the submodules are up to date.
```bash
git submodule update --init --recursive
```
Afterwards Ace can be built by calling
```bash
./Makefile.dryice.js normal
```
The packaged Ace will be put in the 'build' folder.
To build the bookmarklet version execute
```bash
./Makefile.dryice.js bm
```
Running the Unit Tests
----------------------
The Ace unit tests run on node.js. Before the first run a couple of node modules have to be installed. The easiest way to do this is by using the node package manager (npm). In the Ace base directory simply call
```bash
npm link .
```
To run the tests call:
```bash
node lib/ace/test/all.js
```
You can also run the tests in your browser by serving:
http://localhost:8888/lib/ace/test/tests.html
This makes debugging failing tests way more easier.
Contributing
------------
Ace wouldn't be what it is without contributions! Feel free to fork and improve/enhance Ace any way you want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. To protect the interests of the Ace contributors and users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is the simplest of agreements, requiring that the contributions you make to an ajax.org project are only those you're allowed to make. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes ten minutes, and only needs to be completed once. There are two versions of the agreement:
1. [The Individual CLA](https://github.com/ajaxorg/ace/raw/master/doc/Contributor_License_Agreement-v2.pdf): use this version if you're working on an ajax.org in your spare time, or can clearly claim ownership of copyright in what you'll be submitting.
2. [The Corporate CLA](https://github.com/ajaxorg/ace/raw/master/doc/Corporate_Contributor_License_Agreement-v2.pdf): have your corporate lawyer review and submit this if your company is going to be contributing to ajax.org projects
If you want to contribute to an ajax.org project please print the CLA and fill it out and sign it. Then either send it by snail mail or fax to us or send it back scanned (or as a photo) by email.
define("ace/keyboard/keybinding/emacs",["require","exports","module","ace/keyboard/state_handler"],function(a,b,c){vard=a("ace/keyboard/state_handler").StateHandler,e=a("ace/keyboard/state_handler").matchCharacterOnly,f={start:[{key:"ctrl-x",then:"c-x"},{regex:["(?:command-([0-9]*))*","(down|ctrl-n)"],exec:"golinedown",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(right|ctrl-f)"],exec:"gotoright",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(up|ctrl-p)"],exec:"golineup",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(left|ctrl-b)"],exec:"gotoleft",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{comment:"This binding matches all printable characters except numbers as long as they are no numbers and print them n times.",regex:["(?:command-([0-9]*))","([^0-9]+)*"],match:e,exec:"inserttext",params:[{name:"times",match:1,type:"number",defaultValue:"1"},{name:"text",match:2}]},{comment:"This binding matches numbers as long as there is no meta_number in the buffer.",regex:["(command-[0-9]*)*","([0-9]+)"],match:e,disallowMatches:[1],exec:"inserttext",params:[{name:"text",match:2,type:"text"}]},{regex:["command-([0-9]*)","(command-[0-9]|[0-9])"],comment:"Stops execution if the regex /meta_[0-9]+/ matches to avoid resetting the buffer."}],"c-x":[{key:"ctrl-g",then:"start"},{key:"ctrl-s",exec:"save",then:"start"}]};b.Emacs=newd(f)}),define("ace/keyboard/state_handler",["require","exports","module"],function(a,b,c){functione(a){this.keymapping=this.$buildKeymappingRegex(a)}vard=!1;e.prototype={$buildKeymappingRegex:function(a){for(stateina)this.$buildBindingsRegex(a[state]);returna},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=newRegExp("^"+a.key+"$"):Array.isArray(a.regex)?("key"ina||(a.key=newRegExp("^"+a.regex[1]+"$")),a.regex=newRegExp(a.regex.join("")+"$")):a.regex&&(a.regex=newRegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";vard=[];b&1&&d.push("ctrl"),b&8&&d.push("command"),b&2&&d.push("option"),b&4&&d.push("shift"),c&&d.push(c);vare=d.join("-"),f=a.buffer+e;returnb!=2&&(a.buffer=f),{bufferToUse:f,symbolicName:e}},$find:function(a,b,c,e,f){varg={};returnthis.keymapping[a.state].some(function(h){vari;if(h.key&&!h.key.test(c))return!1;if(h.regex&&!(i=h.regex.exec(b)))return!1;if(h.match&&!h.match(b,e,f,c))return!1;if(h.disallowMatches)for(varj=0;j<h.disallowMatches.length;j++)if(!!i[h.disallowMatches[j]])return!1;if(h.exec){g.command=h.exec;if(h.params){vark;g.args={},h.params.forEach(function(a){a.match!=null&&i!=null?k=i[a.match]||a.defaultValue:k=a.defaultValue,a.type==="number"&&(k=parseInt(k)),g.args[a.name]=k})}a.buffer=""}returnh.then&&(a.state=h.then,a.buffer=""),g.command==null&&(g.command="null"),d&&console.log("KeyboardStateMapper#find",h),!0}),g.command?g:(a.buffer="",!1)},handleKeyboard:function(a,b,c){if(b==0||c!=""&&c!=String.fromCharCode(0)){vare=this.$composeBuffer(a,b,c),f=e.bufferToUse,g=e.symbolicName;returne=this.$find(a,f,g,b,c),d&&console.log("KeyboardStateMapper#match",f,g,e),e}returnnull}},b.matchCharacterOnly=function(a,b,c,d){returnb==0?!0:b==4&&c.length==1?!0:!1},b.StateHandler=e})
define("ace/keyboard/keybinding/vim",["require","exports","module","ace/keyboard/state_handler"],function(a,b,c){vard=a("ace/keyboard/state_handler").StateHandler,e=a("ace/keyboard/state_handler").matchCharacterOnly,f=function(a,b,c){return{regex:["([0-9]*)",a],exec:b,params:[{name:"times",match:1,type:"number",defaultValue:1}],then:c}},g={start:[{key:"i",then:"insertMode"},{key:"d",then:"deleteMode"},{key:"a",exec:"gotoright",then:"insertMode"},{key:"shift-i",exec:"gotolinestart",then:"insertMode"},{key:"shift-a",exec:"gotolineend",then:"insertMode"},{key:"shift-c",exec:"removetolineend",then:"insertMode"},{key:"shift-r",exec:"overwrite",then:"replaceMode"},f("(k|up)","golineup"),f("(j|down)","golinedown"),f("(l|right)","golineright"),f("(h|left)","golineleft"),{key:"shift-g",exec:"gotoend"},f("b","gotowordleft"),f("e","gotowordright"),f("x","del"),f("shift-x","backspace"),f("shift-d","removetolineend"),f("u","undo"),{comment:"Catch some keyboard input to stop it here",match:e}],insertMode:[{key:"esc",then:"start"}],replaceMode:[{key:"esc",exec:"overwrite",then:"start"}],deleteMode:[{key:"d",exec:"removeline",then:"start"}]};b.Vim=newd(g)}),define("ace/keyboard/state_handler",["require","exports","module"],function(a,b,c){functione(a){this.keymapping=this.$buildKeymappingRegex(a)}vard=!1;e.prototype={$buildKeymappingRegex:function(a){for(stateina)this.$buildBindingsRegex(a[state]);returna},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=newRegExp("^"+a.key+"$"):Array.isArray(a.regex)?("key"ina||(a.key=newRegExp("^"+a.regex[1]+"$")),a.regex=newRegExp(a.regex.join("")+"$")):a.regex&&(a.regex=newRegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";vard=[];b&1&&d.push("ctrl"),b&8&&d.push("command"),b&2&&d.push("option"),b&4&&d.push("shift"),c&&d.push(c);vare=d.join("-"),f=a.buffer+e;returnb!=2&&(a.buffer=f),{bufferToUse:f,symbolicName:e}},$find:function(a,b,c,e,f){varg={};returnthis.keymapping[a.state].some(function(h){vari;if(h.key&&!h.key.test(c))return!1;if(h.regex&&!(i=h.regex.exec(b)))return!1;if(h.match&&!h.match(b,e,f,c))return!1;if(h.disallowMatches)for(varj=0;j<h.disallowMatches.length;j++)if(!!i[h.disallowMatches[j]])return!1;if(h.exec){g.command=h.exec;if(h.params){vark;g.args={},h.params.forEach(function(a){a.match!=null&&i!=null?k=i[a.match]||a.defaultValue:k=a.defaultValue,a.type==="number"&&(k=parseInt(k)),g.args[a.name]=k})}a.buffer=""}returnh.then&&(a.state=h.then,a.buffer=""),g.command==null&&(g.command="null"),d&&console.log("KeyboardStateMapper#find",h),!0}),g.command?g:(a.buffer="",!1)},handleKeyboard:function(a,b,c){if(b==0||c!=""&&c!=String.fromCharCode(0)){vare=this.$composeBuffer(a,b,c),f=e.bufferToUse,g=e.symbolicName;returne=this.$find(a,f,g,b,c),d&&console.log("KeyboardStateMapper#match",f,g,e),e}returnnull}},b.matchCharacterOnly=function(a,b,c,d){returnb==0?!0:b==4&&c.length==1?!0:!1},b.StateHandler=e})