diff --git a/.gitignore b/.gitignore index 59ec847b..c6a7ecc9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ .DS_Store *.swp *.tmp -*~ # Project files that should not be in the repo .* diff --git a/.gitmodules b/.gitmodules index 07bbe371..4678c516 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "doc/wiki"] path = doc/wiki - url = https://github.com/ajaxorg/ace.wiki.git + url = git://github.com/ajaxorg/ace.wiki.git [submodule "build"] path = build - url = https://github.com/ajaxorg/ace-builds.git + url = git://github.com/ajaxorg/ace-builds.git diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 062af59c..c44edcb0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,9 +7,16 @@ Feel free to fork and improve/enhance Ace any way you want. If you feel that the 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. +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 the Cloud9 SDK and/or open source projects please go to the online form, fill it out and submit it. +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. -Happy coding, Cloud9 +Email: ace+cla@c9.io + +Fax: +31 (0) 206388953 + +Address: Ajax.org B.V. + Keizersgracht 241 + 1016 EA, Amsterdam + the Netherlands \ No newline at end of file diff --git a/ChangeLog.txt b/ChangeLog.txt index 3077d171..589d9a46 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,48 +1,3 @@ -Version 1.2.0-pre - -* New Features - - Indented soft wrap (danyaPostfactum) - -* API Changes - - unified delta types `{start, end, action, lines}` (Alden Daniels https://github.com/ajaxorg/ace/pull/1745) - - "change" event listeners on session and editor get delta objects directly - -2015.04.03 Version 1.1.9 - - - Small Enhancements and Bugfixes - -2014.11.08 Version 1.1.8 - -* API Changes - - `editor.commands.commandKeyBinding` now contains direct map from keys to commands instead of grouping them by hashid - -* New Features - - Improved autoindent for html and php modes (Adam Jimenez) - - Find All from searchbox (Colton Voege) - -* new language modes - - Elixir, Elm - -2014.09.21 Version 1.1.7 - -* Bugfixes - - fix several bugs in autocompletion - - workaround for inaccurate getBoundingClientRect on chrome 37 - -2014.08.17 Version 1.1.6 - -* Bugfixes - - fix regression in double tap to highlight - - Improved Latex Mode (Daniel Felder) - -* API Changes - - editor.destroy destroys editor.session too (call editor.setSession(null) to prevent that) - -* new language modes - - Praat (José Joaquín Atria) - - Eiffel (Victorien Elvinger) - - G-code (Adam Joseph Cook) - 2014.07.09 Version 1.1.5 * Bugfixes diff --git a/Makefile.dryice.js b/Makefile.dryice.js index 0ce7c657..2bc36f8b 100755 --- a/Makefile.dryice.js +++ b/Makefile.dryice.js @@ -120,7 +120,6 @@ function demo() { function changeComments(data) { return (data - .replace("doc/site/images/ace-logo.png", "demo/kitchen-sink/ace-logo.png") .replace(//g, "") .replace(/PACKAGE\-\->|

Creates a new Editor object.

-

Arguments

rendererVirtualRenderer

Required. Associated VirtualRenderer that draws everything

-
sessionEditSession

Required. The EditSession to refer to

+

Arguments

rendererVirtualRenderer

Required. Associated VirtualRenderer that draws everything

+
sessionEditSession

Required. The EditSession to refer to

@@ -444,7 +444,7 @@

Emitted whenever the document is changed.

-

Arguments

eObject

Required. Contains a single property, data, which has the delta of changes

+

Arguments

eObject

Required. Contains a single property, data, which has the delta of changes

@@ -471,7 +471,7 @@

Emitted when the selection style changes, via Editor.setSelectionStyle().

-

Arguments

dataObject

Required. Contains one property, data, which indicates the new selection style

+

Arguments

dataObject

Required. Contains one property, data, which indicates the new selection style

@@ -498,7 +498,7 @@

Emitted whenever the EditSession changes.

-

Arguments

eObject

Required. An object with two properties, oldSession and session, that represent the old and new EditSessions.

+

Arguments

eObject

Required. An object with two properties, oldSession and session, that represent the old and new EditSessions.

@@ -525,7 +525,7 @@

Emitted when text is copied.

-

Arguments

textString

Required. The copied text

+

Arguments

textString

Required. The copied text

@@ -564,7 +564,7 @@
    • -
    • Editor.on("paste", function(Object e))
    • +
    • Editor.on("paste", function(String text))
    @@ -577,7 +577,7 @@

    Emitted when text is pasted.

    -

    Arguments

    eObject

    Required. An object which contains one property, text, that represents the text to be pasted. Editing this property will alter the text that is pasted.

    +

    Arguments

    textString

    Required. The pasted text

    @@ -610,7 +610,7 @@

    Adds the selection and cursor.

    -

    Arguments

    orientedRangeRange

    Required. A range containing a cursor

    +

    Arguments

    orientedRangeRange

    Required. A range containing a cursor

    @@ -920,9 +920,9 @@

    Attempts to find needle within the document. For more information on options, see Search.

    -

    Arguments

    needleString

    Required. The text to search for (optional)

    -
    optionsObject

    Required. An object defining various search properties

    -
    animateBoolean

    Required. If true animate scrolling

    +

    Arguments

    needleString

    Required. The text to search for (optional)

    +
    optionsObject

    Required. An object defining various search properties

    +
    animateBoolean

    Required. If true animate scrolling

    @@ -954,9 +954,9 @@

    Finds and selects all the occurences of needle.

    -

    Arguments

    TheString

    Required. text to find

    -
    TheObject

    Required. search options

    -
    keepsBoolean

    Required.

    +

    Arguments

    TheString

    Required. text to find

    +
    TheObject

    Required. search options

    +
    keepsBoolean

    Required.

    @@ -983,8 +983,8 @@

    Performs another search for needle in the document. For more information on options, see Search.

    -

    Arguments

    optionsObject

    Required. search options

    -
    animateBoolean

    Required. If true animate scrolling

    +

    Arguments

    optionsObject

    Required. search options

    +
    animateBoolean

    Required. If true animate scrolling

    @@ -1011,8 +1011,8 @@

    Performs a search for needle backwards. For more information on options, see Search.

    -

    Arguments

    optionsObject

    Required. search options

    -
    animateBoolean

    Required. If true animate scrolling

    +

    Arguments

    optionsObject

    Required. search options

    +
    animateBoolean

    Required. If true animate scrolling

    @@ -1064,8 +1064,8 @@

    Executes a command for each selection range.

    -

    Arguments

    cmdString

    Required. The command to execute

    -
    argsString

    Required. Any arguments for the command

    +

    Arguments

    cmdString

    Required. The command to execute

    +
    argsString

    Required. Any arguments for the command

    @@ -1523,8 +1523,8 @@

    Works like EditSession.getTokenAt(), except it returns a number.

    -

    Arguments

    rowObject

    Required.

    -
    columnObject

    Required.

    +

    Arguments

    rowObject

    Required.

    +
    columnObject

    Required.

    @@ -1966,9 +1966,9 @@

    Moves the cursor to the specified line number, and also into the indiciated column.

    -

    Arguments

    lineNumberNumber

    Required. The line number to go to

    -
    columnNumber

    Required. A column number to go to

    -
    animateBoolean

    Required. If true animates scolling

    +

    Arguments

    lineNumberNumber

    Required. The line number to go to

    +
    columnNumber

    Required. A column number to go to

    +
    animateBoolean

    Required. If true animates scolling

    @@ -2070,7 +2070,7 @@

    Inserts text into wherever the cursor is pointing.

    -

    Arguments

    textString

    Required. The new text to add

    +

    Arguments

    textString

    Required. The new text to add

    @@ -2132,7 +2132,7 @@

    Indicates if the entire row is currently visible on the screen.

    -

    Arguments

    rowNumber

    Required. The row to check

    +

    Arguments

    rowNumber

    Required. The row to check

    @@ -2164,7 +2164,7 @@

    Indicates if the row is currently visible on the screen.

    -

    Arguments

    rowNumber

    Required. The row to check

    +

    Arguments

    rowNumber

    Required. The row to check

    @@ -2191,7 +2191,7 @@

    Moves the cursor's row and column to the next matching bracket.

    -

    Arguments

    selectObject

    Required.

    +

    Arguments

    selectObject

    Required.

    @@ -2218,7 +2218,7 @@

    If the character before the cursor is a number, this functions changes its value by amount.

    -

    Arguments

    amountNumber

    Required. The value to change the numeral by (can be negative to decrease value)

    +

    Arguments

    amountNumber

    Required. The value to change the numeral by (can be negative to decrease value)

    @@ -2245,8 +2245,8 @@

    Moves the cursor to the specified row and column. Note that this does not de-select the current selection.

    -

    Arguments

    rowNumber

    Required. The new row number

    -
    columnNumber

    Required. The new column number

    +

    Arguments

    rowNumber

    Required. The new row number

    +
    columnNumber

    Required. The new column number

    @@ -2273,7 +2273,7 @@

    Moves the cursor to the position indicated by pos.row and pos.column.

    -

    Arguments

    posObject

    Required. An object with two properties, row and column

    +

    Arguments

    posObject

    Required. An object with two properties, row and column

    @@ -2384,7 +2384,7 @@

    Moves the cursor down in the document the specified number of times. Note that this does de-select the current selection.

    -

    Arguments

    timesNumber

    Required. The number of times to change navigation

    +

    Arguments

    timesNumber

    Required. The number of times to change navigation

    @@ -2461,7 +2461,7 @@

    Moves the cursor left in the document the specified number of times. Note that this does de-select the current selection.

    -

    Arguments

    timesNumber

    Required. The number of times to change navigation

    +

    Arguments

    timesNumber

    Required. The number of times to change navigation

    @@ -2538,7 +2538,7 @@

    Moves the cursor right in the document the specified number of times. Note that this does de-select the current selection.

    -

    Arguments

    timesNumber

    Required. The number of times to change navigation

    +

    Arguments

    timesNumber

    Required. The number of times to change navigation

    @@ -2565,8 +2565,8 @@

    Moves the cursor to the specified row and column. Note that this does de-select the current selection.

    -

    Arguments

    rowNumber

    Required. The new row number

    -
    columnNumber

    Required. The new column number

    +

    Arguments

    rowNumber

    Required. The new row number

    +
    columnNumber

    Required. The new column number

    @@ -2593,7 +2593,7 @@

    Moves the cursor up in the document the specified number of times. Note that this does de-select the current selection.

    -

    Arguments

    timesNumber

    Required. The number of times to change navigation

    +

    Arguments

    timesNumber

    Required. The number of times to change navigation

    @@ -3105,7 +3105,7 @@

    Called whenever a text "paste" happens.

    -

    Arguments

    textString

    Required. The pasted text

    +

    Arguments

    textString

    Required. The pasted text

    @@ -3277,7 +3277,7 @@

    Removes words of text from the editor. A "word" is defined as a string of characters bookended by whitespace.

    -

    Arguments

    dirString

    Required. The direction of the deletion to occur, either "left" or "right"

    +

    Arguments

    dirString

    Required. The direction of the deletion to occur, either "left" or "right"

    @@ -3329,7 +3329,7 @@

    Removes the selection marker.

    -

    Arguments

    TheRange

    Required. selection range added with addSelectionMarker().

    +

    Arguments

    TheRange

    Required. selection range added with addSelectionMarker().

    @@ -3456,8 +3456,8 @@

    Replaces the first occurance of options.needle with the value in replacement.

    -

    Arguments

    replacementString

    Required. The text to replace with

    -
    optionsObject

    Required. The Search options to use

    +

    Arguments

    replacementString

    Required. The text to replace with

    +
    optionsObject

    Required. The Search options to use

    @@ -3484,8 +3484,8 @@

    Replaces all occurances of options.needle with the value in replacement.

    -

    Arguments

    replacementString

    Required. The text to replace with

    -
    optionsObject

    Required. The Search options to use

    +

    Arguments

    replacementString

    Required. The text to replace with

    +
    optionsObject

    Required. The Search options to use

    @@ -3512,7 +3512,7 @@

    Triggers a resize of the editor.

    -

    Arguments

    forceBoolean

    Required. If true, recomputes the size, even if the height and width haven't changed

    +

    Arguments

    forceBoolean

    Required. If true, recomputes the size, even if the height and width haven't changed

    @@ -3613,10 +3613,10 @@

    Scrolls to a line. If center is true, it puts the line in middle of screen (or attempts to).

    -

    Arguments

    lineNumber

    Required. The line to scroll to

    -
    centerBoolean

    Required. If true

    -
    animateBoolean

    Required. If true animates scrolling

    -
    callbackFunction

    Required. Function to be called when the animation has finished

    +

    Arguments

    lineNumber

    Required. The line to scroll to

    +
    centerBoolean

    Required. If true

    +
    animateBoolean

    Required. If true animates scrolling

    +
    callbackFunction

    Required. Function to be called when the animation has finished

    @@ -3643,7 +3643,7 @@

    Moves the editor to the specified row.

    -

    Arguments

    rowObject

    Required.

    +

    Arguments

    rowObject

    Required.

    @@ -3695,8 +3695,8 @@

    Finds the next occurence of text in an active selection and adds it to the selections.

    -

    Arguments

    dirNumber

    Required. The direction of lines to select: -1 for up, 1 for down

    -
    skipBoolean

    Required. If true, removes the active selection range

    +

    Arguments

    dirNumber

    Required. The direction of lines to select: -1 for up, 1 for down

    +
    skipBoolean

    Required. If true, removes the active selection range

    @@ -3723,8 +3723,8 @@

    Adds a cursor above or below the active cursor.

    -

    Arguments

    dirNumber

    Required. The direction of lines to select: -1 for up, 1 for down

    -
    skipBoolean

    Required. If true, removes the active selection range

    +

    Arguments

    dirNumber

    Required. The direction of lines to select: -1 for up, 1 for down

    +
    skipBoolean

    Required. If true, removes the active selection range

    @@ -3825,7 +3825,7 @@

    Specifies whether to use behaviors or not. "Behaviors" in this case is the auto-pairing of special characters, like quotation marks, parenthesis, or brackets.

    -

    Arguments

    enabledBoolean

    Required. Enables or disables behaviors

    +

    Arguments

    enabledBoolean

    Required. Enables or disables behaviors

    @@ -3876,7 +3876,7 @@

    Sets the delay (in milliseconds) of the mouse drag.

    -

    Arguments

    dragDelayNumber

    Required. A value indicating the new delay

    +

    Arguments

    dragDelayNumber

    Required. A value indicating the new delay

    @@ -3927,7 +3927,7 @@

    Set a new font size (in pixels) for the editor text.

    -

    Arguments

    sizeNumber

    Required. A font size

    +

    Arguments

    sizeNumber

    Required. A font size

    @@ -3954,7 +3954,7 @@

    Determines whether or not the current line should be highlighted.

    -

    Arguments

    shouldHighlightBoolean

    Required. Set to true to highlight the current line

    +

    Arguments

    shouldHighlightBoolean

    Required. Set to true to highlight the current line

    @@ -4005,7 +4005,7 @@

    Determines if the currently selected word should be highlighted.

    -

    Arguments

    shouldHighlightBoolean

    Required. Set to true to highlight the currently selected word

    +

    Arguments

    shouldHighlightBoolean

    Required. Set to true to highlight the currently selected word

    @@ -4032,7 +4032,7 @@

    Sets a new key handler, such as "vim" or "windows".

    -

    Arguments

    keyboardHandlerString

    Required. The new key handler

    +

    Arguments

    keyboardHandlerString

    Required. The new key handler

    @@ -4059,7 +4059,7 @@

    Pass in true to enable overwrites in your session, or false to disable. If overwrites is enabled, any text you enter will type over any text after it. If the value of overwrite changes, this function also emites the changeOverwrite event.

    -

    Arguments

    overwriteBoolean

    Required. Defines wheter or not to set overwrites

    +

    Arguments

    overwriteBoolean

    Required. Defines wheter or not to set overwrites

    @@ -4086,7 +4086,7 @@

    Sets the column defining where the print margin should be.

    -

    Arguments

    showPrintMarginNumber

    Required. Specifies the new print margin

    +

    Arguments

    showPrintMarginNumber

    Required. Specifies the new print margin

    @@ -4113,7 +4113,7 @@

    If readOnly is true, then the editor is set to read-only mode, and none of the content can change.

    -

    Arguments

    readOnlyBoolean

    Required. Specifies whether the editor can be modified or not

    +

    Arguments

    readOnlyBoolean

    Required. Specifies whether the editor can be modified or not

    @@ -4140,7 +4140,7 @@

    Sets how fast the mouse scrolling should do.

    -

    Arguments

    speedNumber

    Required. A value indicating the new speed (in milliseconds)

    +

    Arguments

    speedNumber

    Required. A value indicating the new speed (in milliseconds)

    @@ -4170,7 +4170,7 @@ although this code change in the future.

    This function also emits the 'changeSelectionStyle' event.

    -

    Arguments

    styleString

    Required. The new selection style

    +

    Arguments

    styleString

    Required. The new selection style

    @@ -4197,7 +4197,7 @@ although this code change in the future.

    Sets a new editsession to use. This method also emits the 'changeSession' event.

    -

    Arguments

    sessionEditSession

    Required. The new session to use

    +

    Arguments

    sessionEditSession

    Required. The new session to use

    @@ -4224,7 +4224,7 @@ although this code change in the future.

    Indicates whether the fold widgets are shown or not.

    -

    Arguments

    showBoolean

    Required. Specifies whether the fold widgets are shown

    +

    Arguments

    showBoolean

    Required. Specifies whether the fold widgets are shown

    @@ -4251,7 +4251,7 @@ although this code change in the future.

    If showInvisibles is set to true, invisible characters—like spaces or new lines—are show in the editor.

    -

    Arguments

    showInvisiblesBoolean

    Required. Specifies whether or not to show invisible characters

    +

    Arguments

    showInvisiblesBoolean

    Required. Specifies whether or not to show invisible characters

    @@ -4278,7 +4278,7 @@ although this code change in the future.

    If showPrintMargin is set to true, the print margin is shown in the editor.

    -

    Arguments

    showPrintMarginBoolean

    Required. Specifies whether or not to show the print margin

    +

    Arguments

    showPrintMarginBoolean

    Required. Specifies whether or not to show the print margin

    @@ -4305,7 +4305,7 @@ although this code change in the future.

    Adds a new class, style, to the editor.

    -

    Arguments

    styleString

    Required. A class name

    +

    Arguments

    styleString

    Required. A class name

    @@ -4332,7 +4332,7 @@ although this code change in the future.

    Sets a new theme for the editor. theme should exist, and be a directory path, like ace/theme/textmate.

    -

    Arguments

    themeString

    Required. The path to a theme

    +

    Arguments

    themeString

    Required. The path to a theme

    @@ -4364,8 +4364,8 @@ although this code change in the future.

    Sets the current document to val.

    -

    Arguments

    valString

    Required. The new value to set for the document

    -
    cursorPosNumber

    Required. Where to set the new value. undefined or 0 is selectAll, -1 is at the document start, and 1 is at the end

    +

    Arguments

    valString

    Required. The new value to set for the document

    +
    cursorPosNumber

    Required. Where to set the new value. undefined or 0 is selectAll, -1 is at the document start, and 1 is at the end

    @@ -4394,7 +4394,7 @@ when such a character is typed in.

    Specifies whether to use wrapping behaviors or not, i.e. automatically wrapping the selection with characters such as brackets when such a character is typed in.

    -

    Arguments

    enabledBoolean

    Required. Enables or disables wrapping behaviors

    +

    Arguments

    enabledBoolean

    Required. Enables or disables wrapping behaviors

    @@ -4595,7 +4595,7 @@ when such a character is typed in.

    Transposes the selected ranges.

    -

    Arguments

    dirNumber

    Required. The direction to rotate selections

    +

    Arguments

    dirNumber

    Required. The direction to rotate selections

    @@ -4647,7 +4647,7 @@ when such a character is typed in.

    Removes the class style from the editor.

    -

    Arguments

    styleObject

    Required.

    +

    Arguments

    styleObject

    Required.

    diff --git a/api/selection.html b/api/selection.html index 4da8f771..ac070704 100644 --- a/api/selection.html +++ b/api/selection.html @@ -163,7 +163,7 @@

    Contains the cursor position and the text selection of an edit session.

    -

    The row/columns used in the selection are in document coordinates representing the coordinates as they appear in the document before applying soft wrap and folding.

    +

    The row/columns used in the selection are in document coordinates representing ths coordinates as thez appear in the document before applying soft wrap and folding.

    @@ -1778,4 +1778,4 @@
    - + \ No newline at end of file diff --git a/build b/build index a4e495d8..cbc08e4e 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit a4e495d8901876c6bafe3870a35cb8e32c827e97 +Subproject commit cbc08e4ebc4843eebec8dcd213751cb0d64c955b diff --git a/build_support/bookmarklet.html b/build_support/bookmarklet.html index 88355f78..f3d95ee7 100644 --- a/build_support/bookmarklet.html +++ b/build_support/bookmarklet.html @@ -51,7 +51,7 @@ function foo() { function inject(options, callback) { var baseUrl = options.baseUrl || "../../src-noconflict"; - + var load = function(path, callback) { var head = document.getElementsByTagName('head')[0]; var s = document.createElement('script'); @@ -87,7 +87,7 @@ function inject(options, callback) { // Call the inject function to load the ace files. var textAce; inject({}, function () { - // Transform the textarea on the page into an ace editor. + // Transform the textarea on the page into an ace editor. var t = document.querySelector("textarea"); textAce = ace.require("ace/ext/textarea").transformTextarea(t); setTimeout(function(){textAce.setDisplaySettings(true)}); diff --git a/build_support/editor.html b/build_support/editor.html index 1d972cf9..06a4651b 100644 --- a/build_support/editor.html +++ b/build_support/editor.html @@ -8,8 +8,8 @@ body { overflow: hidden; } - - #editor { + + #editor { margin: 0; position: absolute; top: 0; @@ -27,7 +27,7 @@ alert("Ace Rocks " + items[i]); } } - + @@ -47,13 +46,6 @@ require(["ace/ace"], function(ace) { editor2.setOption("maxLines", 30); editor2.setOption("minLines", 2); - var editor = ace.edit("editor3"); - editor.setOptions({ - autoScrollEditorIntoView: true, - maxLines: 8 - }); - editor.renderer.setScrollMargin(10, 10, 10, 10); - var editor = ace.edit("editor"); editor.setTheme("ace/theme/tomorrow"); editor.session.setMode("ace/mode/html"); diff --git a/demo/emmet.html b/demo/emmet.html index bd0d4abe..122085d9 100644 --- a/demo/emmet.html +++ b/demo/emmet.html @@ -23,7 +23,7 @@
    
     
     
    -
    +
     
     
     
     
    -        
    -    
    -    
    -        

    - -
    - - - \ No newline at end of file diff --git a/index.html b/index.html index e2440eb1..a82cf8a7 100644 --- a/index.html +++ b/index.html @@ -196,7 +196,8 @@ console.log(addResult);

    > See all themes

    Setting the Programming Language Mode

    By default, the editor supports plain text mode. All other language modes are available as separate modules, loaded on demand like this:

    -
    editor.getSession().setMode("ace/mode/javascript");
    +
    editor.getSession().setMode("ace/mode/javascript");
    +                            
    1); -}; -var testRanges = function(str) { - assert.equal(editor.selection.getAllRanges() + "", str + ""); -}; - -module.exports = { - "test: cstyle": function() { - function testValue(line) { - assert.equal(editor.getValue(), Array(4).join(line + "\n")); - } - function testSelection(line, col, inc) { - editor.selection.rangeList.ranges.forEach(function(r) { - assert.range(r, line, col, line, col); - line += (inc || 1); - }); - } - var doc = new EditSession([ - "", - "", - "", - "" - ], new JavaScriptMode()); - editor = new Editor(new MockRenderer(), doc); - editor.setOption("behavioursEnabled", true); - - editor.navigateFileStart(); - exec("addCursorBelow", 2); - - exec("insertstring", 1, "if "); - - // pairing ( - exec("insertstring", 1, "("); - testValue("if ()"); - testSelection(0, 4); - exec("insertstring", 1, ")"); - testValue("if ()"); - testSelection(0, 5); - - // pairing [ - exec("gotoleft", 1); - exec("insertstring", 1, "["); - testValue("if ([])"); - testSelection(0, 5); - - exec("insertstring", 1, "]"); - testValue("if ([])"); - testSelection(0, 6); - - // test deletion - exec("gotoleft", 1); - exec("backspace", 1); - testValue("if ()"); - testSelection(0, 4); - - exec("gotolineend", 1); - exec("insertstring", 1, "{"); - testValue("if (){}"); - testSelection(0, 6); - - exec("insertstring", 1, "}"); - testValue("if (){}"); - testSelection(0, 7); - - exec("gotolinestart", 1); - exec("insertstring", 1, "("); - testValue("(if (){}"); - exec("backspace", 1); - - editor.setValue(""); - exec("insertstring", 1, "{"); - assert.equal(editor.getValue(), "{"); - exec("insertstring", 1, "\n"); - assert.equal(editor.getValue(), "{\n \n}"); - - editor.setValue(""); - exec("insertstring", 1, "("); - exec("insertstring", 1, '"'); - exec("insertstring", 1, '"'); - assert.equal(editor.getValue(), '("")'); - exec("backspace", 1); - exec("insertstring", 1, '"'); - assert.equal(editor.getValue(), '("")'); - - editor.setValue("('foo')", 1); - exec("gotoleft", 1); - exec("selectleft", 1); - exec("selectMoreBefore", 1); - exec("insertstring", 1, "'"); - assert.equal(editor.getValue(), "('foo')"); - exec("selectleft", 1); - exec("insertstring", 1, '"'); - assert.equal(editor.getValue(), '("foo")'); - exec("selectleft", 1); - exec("insertstring", 1, '"'); - assert.equal(editor.getValue(), '("foo")'); - - editor.setValue("", 1); - exec("selectleft", 1); - exec("insertstring", 1, '"'); - assert.equal(editor.getValue(), '""'); - exec("insertstring", 1, '\\'); - exec("insertstring", 1, 'n'); - exec("insertstring", 1, '"'); - assert.equal(editor.getValue(), '"\\n"'); - - }, - "test: xml": function() { - editor = new Editor(new MockRenderer()); - editor.setValue(["", - " " - ].join("\n")); - editor.session.setMode(new XMLMode); - exec("gotolinedown", 1); - exec("gotolineend", 1); - exec("insertstring", 1, '\n'); - assert.equal(editor.session.getLine(2), " "); - exec("gotolineup", 1); - exec("gotolineend", 1); - exec("insertstring", 1, '\n'); - assert.equal(editor.session.getLine(2), " "); - } -}; - -}); - -if (typeof module !== "undefined" && module === require.main) { - require("asyncjs").test.testcase(module.exports).exec(); -} diff --git a/lib/ace/mode/behaviour/cstyle.js b/lib/ace/mode/behaviour/cstyle.js index dd1b0d14..2709168e 100644 --- a/lib/ace/mode/behaviour/cstyle.js +++ b/lib/ace/mode/behaviour/cstyle.js @@ -42,11 +42,11 @@ var SAFE_INSERT_BEFORE_TOKENS = ["text", "paren.rparen", "punctuation.operator", "comment"]; var context; -var contextCache = {}; +var contextCache = {} var initContext = function(editor) { var id = -1; if (editor.multiSelect) { - id = editor.selection.index; + id = editor.selection.id; if (contextCache.rangeCount != editor.multiSelect.rangeCount) contextCache = {rangeCount: editor.multiSelect.rangeCount}; } @@ -63,19 +63,6 @@ var initContext = function(editor) { }; }; -var getWrapped = function(selection, selected, opening, closing) { - var rowDiff = selection.end.row - selection.start.row; - return { - text: opening + selected + closing, - selection: [ - 0, - selection.start.column + 1, - rowDiff, - selection.end.column + (rowDiff ? 0 : 1) - ] - }; -}; - var CstyleBehaviour = function() { this.add("braces", "insertion", function(state, action, editor, session, text) { var cursor = editor.getCursorPosition(); @@ -85,7 +72,10 @@ var CstyleBehaviour = function() { var selection = editor.getSelectionRange(); var selected = session.doc.getTextRange(selection); if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return getWrapped(selection, selected, '{', '}'); + return { + text: '{' + selected + '}', + selection: false + }; } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) { CstyleBehaviour.recordAutoInsert(editor, session, "}"); @@ -165,7 +155,10 @@ var CstyleBehaviour = function() { var selection = editor.getSelectionRange(); var selected = session.doc.getTextRange(selection); if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return getWrapped(selection, selected, '(', ')'); + return { + text: '(' + selected + ')', + selection: false + }; } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { CstyleBehaviour.recordAutoInsert(editor, session, ")"); return { @@ -210,7 +203,10 @@ var CstyleBehaviour = function() { var selection = editor.getSelectionRange(); var selected = session.doc.getTextRange(selection); if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return getWrapped(selection, selected, '[', ']'); + return { + text: '[' + selected + ']', + selection: false + }; } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { CstyleBehaviour.recordAutoInsert(editor, session, "]"); return { @@ -256,45 +252,56 @@ var CstyleBehaviour = function() { var selection = editor.getSelectionRange(); var selected = session.doc.getTextRange(selection); if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - return getWrapped(selection, selected, quote, quote); - } else if (!selected) { + return { + text: quote + selected + quote, + selection: false + }; + } else { var cursor = editor.getCursorPosition(); var line = session.doc.getLine(cursor.row); var leftChar = line.substring(cursor.column-1, cursor.column); - var rightChar = line.substring(cursor.column, cursor.column + 1); - - var token = session.getTokenAt(cursor.row, cursor.column); - var rightToken = session.getTokenAt(cursor.row, cursor.column + 1); + // We're escaped. - if (leftChar == "\\" && token && /escape/.test(token.type)) + if (leftChar == '\\') { return null; - - var stringBefore = token && /string|escape/.test(token.type); - var stringAfter = !rightToken || /string|escape/.test(rightToken.type); - - var pair; - if (rightChar == quote) { - pair = stringBefore !== stringAfter; - } else { - if (stringBefore && !stringAfter) - return null; // wrap string with different quote - if (stringBefore && stringAfter) - return null; // do not pair quotes inside strings - var wordRe = session.$mode.tokenRe; - wordRe.lastIndex = 0; - var isWordBefore = wordRe.test(leftChar); - wordRe.lastIndex = 0; - var isWordAfter = wordRe.test(leftChar); - if (isWordBefore || isWordAfter) - return null; // before or after alphanumeric - if (rightChar && !/[\s;,.})\]\\]/.test(rightChar)) - return null; // there is rightChar and it isn't closing - pair = true; } - return { - text: pair ? quote + quote : "", - selection: [1,1] - }; + + // Find what token we're inside. + var tokens = session.getTokens(selection.start.row); + var col = 0, token; + var quotepos = -1; // Track whether we're inside an open quote. + + for (var x = 0; x < tokens.length; x++) { + token = tokens[x]; + if (token.type == "string") { + quotepos = -1; + } else if (quotepos < 0) { + quotepos = token.value.indexOf(quote); + } + if ((token.value.length + col) > selection.start.column) { + break; + } + col += tokens[x].value.length; + } + + // Try and be smart about when we auto insert. + if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) { + if (!CstyleBehaviour.isSaneInsertion(editor, session)) + return; + return { + text: quote + quote, + selection: [1,1] + }; + } else if (token && token.type === "string") { + // Ignore input and move right one if we're typing over the closing quote. + var rightChar = line.substring(cursor.column, cursor.column + 1); + if (rightChar == quote) { + return { + text: '', + selection: [1, 1] + }; + } + } } } }); diff --git a/lib/ace/mode/behaviour/xml.js b/lib/ace/mode/behaviour/xml.js index 068fdb31..bd0574c6 100644 --- a/lib/ace/mode/behaviour/xml.js +++ b/lib/ace/mode/behaviour/xml.js @@ -3,7 +3,7 @@ * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright @@ -14,7 +14,7 @@ * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -34,7 +34,6 @@ define(function(require, exports, module) { var oop = require("../../lib/oop"); var Behaviour = require("../behaviour").Behaviour; var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); function is(token, type) { return token.type.lastIndexOf(type + ".xml") > -1; @@ -141,61 +140,29 @@ var XmlBehaviour = function () { return; return { - text: ">" + "", + text: '>' + '', selection: [1, 1] }; } }); - this.add("autoindent", "insertion", function (state, action, editor, session, text) { + this.add('autoindent', 'insertion', function (state, action, editor, session, text) { if (text == "\n") { var cursor = editor.getCursorPosition(); var line = session.getLine(cursor.row); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); + var rightChars = line.substring(cursor.column, cursor.column + 2); + if (rightChars == '") - return; - //get tag name - while (token && token.type.indexOf("tag-name") === -1) { - token = iterator.stepBackward(); - } - - if (!token) { - return; - } - - var tag = token.value; - var row = iterator.getCurrentTokenRow(); - - //don't indent after closing tag - token = iterator.stepBackward(); - if (!token || token.type.indexOf("end-tag") !== -1) { - return; - } - - if (this.voidElements && !this.voidElements[tag]) { - var nextToken = session.getTokenAt(cursor.row, cursor.column+1); - var line = session.getLine(row); - var nextIndent = this.$getIndent(line); - var indent = nextIndent + session.getTabString(); - - if (nextToken && nextToken.value === " the first match is used - this.$rules = { + this.$rules = { "start" : [ { token : "comment", - regex : "//", - next : "singleLineComment" + regex : "\\/\\/.*$" }, DocCommentHighlightRules.getStartRule("doc-start"), { @@ -84,11 +82,11 @@ var c_cppHighlightRules = function() { regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" }, { token : "keyword", // pre-compiler directives - regex : "#\\s*(?:include|import|pragma|line|define|undef)\\b", + regex : "#\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\b", next : "directive" }, { token : "keyword", // special case pre-compiler directive - regex : "#\\s*(?:endif|if|ifdef|else|elif|ifndef)\\b" + regex : "(?:#\\s*endif)\\b" }, { token : "support.function.C99.c", regex : cFunctions @@ -122,26 +120,14 @@ var c_cppHighlightRules = function() { regex : ".+" } ], - "singleLineComment" : [ - { - token : "comment", - regex : /\\$/, - next : "singleLineComment" - }, { - token : "comment", - regex : /$/, - next : "start" - }, { - defaultToken: "comment" - } - ], "qqstring" : [ { token : "string", regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', next : "start" }, { - defaultToken : "string" + token : "string", + regex : '.+' } ], "qstring" : [ @@ -150,7 +136,8 @@ var c_cppHighlightRules = function() { regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", next : "start" }, { - defaultToken : "string" + token : "string", + regex : '.+' } ], "directive" : [ diff --git a/lib/ace/mode/coffee.js b/lib/ace/mode/coffee.js index e866f2b0..34c1a55a 100644 --- a/lib/ace/mode/coffee.js +++ b/lib/ace/mode/coffee.js @@ -116,11 +116,11 @@ oop.inherits(Mode, TextMode); var worker = new WorkerClient(["ace"], "ace/mode/coffee_worker", "Worker"); worker.attachToDocument(session.getDocument()); - worker.on("annotate", function(e) { - session.setAnnotations(e.data); + worker.on("error", function(e) { + session.setAnnotations([e.data]); }); - worker.on("terminate", function() { + worker.on("ok", function(e) { session.clearAnnotations(); }); diff --git a/lib/ace/mode/coffee_highlight_rules.js b/lib/ace/mode/coffee_highlight_rules.js index 94c9476f..a6d33abb 100644 --- a/lib/ace/mode/coffee_highlight_rules.js +++ b/lib/ace/mode/coffee_highlight_rules.js @@ -142,7 +142,7 @@ define(function(require, exports, module) { } if (val == "}" && stack.length) { stack.shift(); - this.next = stack.shift() || ""; + this.next = stack.shift(); if (this.next.indexOf("string") != -1) return "paren.string"; } diff --git a/lib/ace/mode/coffee_worker.js b/lib/ace/mode/coffee_worker.js index d68f1296..a5f700f8 100644 --- a/lib/ace/mode/coffee_worker.js +++ b/lib/ace/mode/coffee_worker.js @@ -49,13 +49,13 @@ oop.inherits(Worker, Mirror); this.onUpdate = function() { var value = this.doc.getValue(); - var errors = []; + try { coffee.parse(value).compile(); } catch(e) { var loc = e.location; if (loc) { - errors.push({ + this.sender.emit("error", { row: loc.first_line, column: loc.first_column, endRow: loc.last_line, @@ -64,8 +64,9 @@ oop.inherits(Worker, Mirror); type: "error" }); } + return; } - this.sender.emit("annotate", errors); + this.sender.emit("ok"); }; }).call(Worker.prototype); diff --git a/lib/ace/mode/css.js b/lib/ace/mode/css.js index 6fef5ccd..c74bd654 100644 --- a/lib/ace/mode/css.js +++ b/lib/ace/mode/css.js @@ -81,7 +81,7 @@ oop.inherits(Mode, TextMode); var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); worker.attachToDocument(session.getDocument()); - worker.on("annotate", function(e) { + worker.on("csslint", function(e) { session.setAnnotations(e.data); }); diff --git a/lib/ace/mode/css/csslint.js b/lib/ace/mode/css/csslint.js index c3c79a80..a3a7a9bd 100644 --- a/lib/ace/mode/css/csslint.js +++ b/lib/ace/mode/css/csslint.js @@ -4,7 +4,7 @@ CSSLint Copyright (c) 2014 Nicole Sullivan and Nicholas C. Zakas. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the 'Software'), to deal +of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is @@ -13,7 +13,7 @@ furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* Build: v0.10.0 22-July-2014 01:17:52 */ +/* Build: v0.10.0 31-March-2014 08:16:48 */ /*! Parser-Lib Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. @@ -46,10 +46,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* Version v0.2.5, Build time: 7-May-2014 03:37:38 */ +/* Version v0.2.4, Build time: 7-January-2014 07:32:49 */ var parserlib = {}; (function(){ + /** * A generic base to inherit from for any object * that needs event handling. @@ -505,7 +506,7 @@ SyntaxUnit.prototype = { * @method valueOf */ valueOf: function(){ - return this.text; + return this.toString(); }, /** @@ -920,6 +921,8 @@ TokenStreamBase.prototype = { }; + + parserlib.util = { StringReader: StringReader, SyntaxError : SyntaxError, @@ -928,6 +931,8 @@ EventTarget : EventTarget, TokenStreamBase : TokenStreamBase }; })(); + + /* Parser-Lib Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. @@ -951,7 +956,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* Version v0.2.5, Build time: 7-May-2014 03:37:38 */ +/* Version v0.2.4, Build time: 7-January-2014 07:32:49 */ (function(){ var EventTarget = parserlib.util.EventTarget, TokenStreamBase = parserlib.util.TokenStreamBase, @@ -959,6 +964,7 @@ StringReader = parserlib.util.StringReader, SyntaxError = parserlib.util.SyntaxError, SyntaxUnit = parserlib.util.SyntaxUnit; + var Colors = { aliceblue :"#f0f8ff", antiquewhite :"#faebd7", @@ -1176,6 +1182,7 @@ function Combinator(text, line, col){ Combinator.prototype = new SyntaxUnit(); Combinator.prototype.constructor = Combinator; + /*global SyntaxUnit, Parser*/ /** * Represents a media feature, such as max-width:500. @@ -1208,6 +1215,7 @@ function MediaFeature(name, value){ MediaFeature.prototype = new SyntaxUnit(); MediaFeature.prototype.constructor = MediaFeature; + /*global SyntaxUnit, Parser*/ /** * Represents an individual media query. @@ -1251,6 +1259,7 @@ function MediaQuery(modifier, mediaType, features, line, col){ MediaQuery.prototype = new SyntaxUnit(); MediaQuery.prototype.constructor = MediaQuery; + /*global Tokens, TokenStream, SyntaxError, Properties, Validation, ValidationError, SyntaxUnit, PropertyValue, PropertyValuePart, SelectorPart, SelectorSubPart, Selector, PropertyName, Combinator, MediaFeature, MediaQuery, EventTarget */ @@ -1512,7 +1521,7 @@ Parser.prototype = function(){ tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); //grab the URI value - uri = tokenStream.token().value.replace(/^(?:url\()?["']?([^"']+?)["']?\)?$/, "$1"); + uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1"); this._readWhitespace(); @@ -1617,10 +1626,8 @@ Parser.prototype = function(){ while(true) { if (tokenStream.peek() == Tokens.PAGE_SYM){ this._page(); - } else if (tokenStream.peek() == Tokens.FONT_FACE_SYM){ + } else if (tokenStream.peek() == Tokens.FONT_FACE_SYM){ this._font_face(); - } else if (tokenStream.peek() == Tokens.VIEWPORT_SYM){ - this._viewport(); } else if (!this._ruleset()){ break; } @@ -2816,7 +2823,7 @@ Parser.prototype = function(){ value = null, operator = null; - value = this._term(inFunction); + value = this._term(); if (value !== null){ values.push(value); @@ -2833,7 +2840,7 @@ Parser.prototype = function(){ valueParts = []; }*/ - value = this._term(inFunction); + value = this._term(); if (value === null){ break; @@ -2851,7 +2858,7 @@ Parser.prototype = function(){ return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null; }, - _term: function(inFunction){ + _term: function(){ /* * term @@ -2865,7 +2872,6 @@ Parser.prototype = function(){ var tokenStream = this._tokenStream, unary = null, value = null, - endChar = null, token, line, col; @@ -2886,20 +2892,6 @@ Parser.prototype = function(){ col = tokenStream.token().startCol; } - //see if it's a simple block - } else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])){ - - token = tokenStream.token(); - endChar = token.endChar; - value = token.value + this._expr(inFunction).text; - if (unary === null){ - line = tokenStream.token().startLine; - col = tokenStream.token().startCol; - } - tokenStream.mustMatch(Tokens.type(endChar)); - value += endChar; - this._readWhitespace(); - //see if there's a simple match } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH, Tokens.ANGLE, Tokens.TIME, @@ -3544,6 +3536,7 @@ nth ['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S* ; */ + /*global Validation, ValidationTypes, ValidationError*/ var Properties = { @@ -3560,7 +3553,6 @@ var Properties = { "animation-delay" : { multi: "