commit
b1bb0b9ccc
22 changed files with 361 additions and 221 deletions
|
|
@ -240,12 +240,9 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
var data = this.tokenizer.getLineTokens(line, state);
|
||||
if (overflow) {
|
||||
data.tokens.push(overflow);
|
||||
data.state = null;
|
||||
data.state = "start";
|
||||
}
|
||||
|
||||
if (data.state == "start" && this.states[row] == null)
|
||||
this.states[row] = "start";
|
||||
|
||||
if (this.states[row] !== data.state) {
|
||||
this.states[row] = data.state;
|
||||
this.lines[row + 1] = null;
|
||||
|
|
|
|||
92
lib/ace/background_tokenizer_test.js
Normal file
92
lib/ace/background_tokenizer_test.js
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Harutyun Amirjanyan <harutyun@c9.io>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var EditSession = require("./edit_session").EditSession;
|
||||
var JavaScriptMode = require("./mode/javascript").Mode;
|
||||
var Range = require("./range").Range;
|
||||
var assert = require("./test/assertions");
|
||||
|
||||
function forceTokenize(session){
|
||||
for (var i = 0, l = session.getLength(); i < l; i++)
|
||||
session.getTokens(i)
|
||||
}
|
||||
|
||||
function testStates(session, states) {
|
||||
for (var i = 0, l = session.getLength(); i < l; i++)
|
||||
assert.equal(session.bgTokenizer.states[i], states[i])
|
||||
assert.ok(l == states.length)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
"test background tokenizer update on session change" : function() {
|
||||
var doc = new EditSession([
|
||||
"/*",
|
||||
"*/",
|
||||
"var juhu"
|
||||
]);
|
||||
doc.setMode("ace/mode/javascript")
|
||||
|
||||
forceTokenize(doc)
|
||||
testStates(doc, ["comment", "start", "start"])
|
||||
|
||||
doc.remove(new Range(0,2,1,2))
|
||||
testStates(doc, [null, "start"])
|
||||
|
||||
forceTokenize(doc)
|
||||
testStates(doc, ["comment", "comment"])
|
||||
|
||||
doc.insert({row:0, column:2}, "\n*/")
|
||||
testStates(doc, [undefined, undefined, "comment"])
|
||||
|
||||
forceTokenize(doc)
|
||||
testStates(doc, ["comment", "start", "start"])
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec()
|
||||
}
|
||||
|
|
@ -51,16 +51,11 @@ oop.inherits(CommandManager, HashHandler);
|
|||
if (editor && editor.$readOnly && !command.readOnly)
|
||||
return false;
|
||||
|
||||
try {
|
||||
var retvalue = this._emit("exec", {
|
||||
editor: editor,
|
||||
command: command,
|
||||
args: args
|
||||
});
|
||||
} catch (e) {
|
||||
window.console && window.console.log(e);
|
||||
return true;
|
||||
}
|
||||
var retvalue = this._emit("exec", {
|
||||
editor: editor,
|
||||
command: command,
|
||||
args: args
|
||||
});
|
||||
|
||||
return retvalue === false ? false : true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -79,12 +79,15 @@ exports.defaultCommands = [{
|
|||
exec: function(editor) { editor.selectMore(1, true); },
|
||||
bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"},
|
||||
readonly: true
|
||||
}, {
|
||||
}, {
|
||||
name: "splitIntoLines",
|
||||
exec: function(editor) { editor.multiSelect.splitIntoLines(); },
|
||||
bindKey: {win: "Ctrl-Shift-L", mac: "Ctrl-Shift-L"},
|
||||
readonly: true
|
||||
}, {
|
||||
}];
|
||||
|
||||
// commands active in multiselect mode
|
||||
exports.multiSelectCommands = [{
|
||||
name: "singleSelection",
|
||||
bindKey: "esc",
|
||||
exec: function(editor) { editor.exitMultiSelectMode(); },
|
||||
|
|
@ -92,10 +95,7 @@ exports.defaultCommands = [{
|
|||
isAvailable: function(editor) {return editor.inMultiSelectMode}
|
||||
}];
|
||||
|
||||
// commands active in multiselect mode
|
||||
exports.multiEditCommands = {"singleSelection": "esc"};
|
||||
|
||||
var HashHandler = require("../keyboard/hash_handler").HashHandler;
|
||||
exports.keyboardHandler = new HashHandler(exports.multiEditCommands);
|
||||
exports.keyboardHandler = new HashHandler(exports.multiSelectCommands);
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -55,14 +55,14 @@ var options = {
|
|||
|
||||
exports.get = function(key) {
|
||||
if (!options.hasOwnProperty(key))
|
||||
throw new Error("Unknown confik key: " + key);
|
||||
throw new Error("Unknown config key: " + key);
|
||||
|
||||
return options[key];
|
||||
};
|
||||
|
||||
exports.set = function(key, value) {
|
||||
if (!options.hasOwnProperty(key))
|
||||
throw new Error("Unknown confik key: " + key);
|
||||
throw new Error("Unknown config key: " + key);
|
||||
|
||||
options[key] = value;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,12 +27,6 @@
|
|||
z-index: 4;
|
||||
}
|
||||
|
||||
.ace_gutter_active_line {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.ace_scroller.horscroll {
|
||||
box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;
|
||||
}
|
||||
|
|
@ -198,13 +192,13 @@
|
|||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
|
||||
|
||||
display: inline-block;
|
||||
height: 11px;
|
||||
margin-top: -2px;
|
||||
vertical-align: middle;
|
||||
|
||||
background-image:
|
||||
background-image:
|
||||
url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%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%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82"),
|
||||
url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ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08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%3AIDAT8%11c%FC%FF%FF%7F%18%03%1A%60%01%F2%3F%A0%891%80%04%FF%11-%F8%17%9BJ%E2%05%B1ZD%81v%26t%E7%80%F8%A3%82h%A12%1A%20%A3%01%02%0F%01%BA%25%06%00%19%C0%0D%AEF%D5%3ES%00%00%00%00IEND%AEB%60%82");
|
||||
background-repeat: no-repeat, repeat-x;
|
||||
|
|
@ -215,7 +209,7 @@
|
|||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
|
||||
|
||||
cursor: pointer;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
|
@ -224,7 +218,7 @@
|
|||
}
|
||||
|
||||
.ace_fold:hover{
|
||||
background-image:
|
||||
background-image:
|
||||
url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40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00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82"),
|
||||
url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C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AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%003IDAT8%11c%FC%FF%FF%7F%3E%03%1A%60%01%F2%3F%A3%891%80%04%FFQ%26%F8w%C0%B43%A1%DB%0C%E2%8F%0A%A2%85%CAh%80%8C%06%08%3C%04%E8%96%18%00%A3S%0D%CD%CF%D8%C1%9D%00%00%00%00IEND%AEB%60%82");
|
||||
background-repeat: no-repeat, repeat-x;
|
||||
|
|
@ -249,7 +243,7 @@
|
|||
height: 14px;
|
||||
width: 11px;
|
||||
vertical-align: text-bottom;
|
||||
|
||||
|
||||
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAe%8A%B1%0D%000%0C%C2%F2%2CK%96%BC%D0%8F9%81%88H%E9%D0%0E%96%C0%10%92%3E%02%80%5E%82%E4%A9*-%EEsw%C8%CC%11%EE%96w%D8%DC%E9*Eh%0C%151(%00%00%00%00IEND%AEB%60%82");
|
||||
background-repeat: no-repeat;
|
||||
background-position: center 5px;
|
||||
|
|
@ -294,23 +288,19 @@
|
|||
}
|
||||
|
||||
.ace_fade-fold-widgets .ace_fold-widget {
|
||||
-moz-transition: 0.5s opacity;
|
||||
-webkit-transition: 0.5s opacity;
|
||||
-o-transition: 0.5s opacity;
|
||||
-ms-transition: 0.5s opacity;
|
||||
transition: 0.5s opacity;
|
||||
-moz-transition: opacity 0.4s ease 0.05s;
|
||||
-webkit-transition: opacity 0.4s ease 0.05s;
|
||||
-o-transition: opacity 0.4s ease 0.05s;
|
||||
-ms-transition: opacity 0.4s ease 0.05s;
|
||||
transition: opacity 0.4s ease 0.05s;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.ace_fade-fold-widgets:hover .ace_fold-widget {
|
||||
-moz-transition-duration: 0.05s;
|
||||
-webkit-transition-duration: 0.05s;
|
||||
-o-transition-duration: 0.05s;
|
||||
-ms-transition-duration: 0.05s;
|
||||
transition-duration: 0.05s;
|
||||
-moz-transition-delay: 0.2s;
|
||||
-webkit-transition-delay: 0.2s;
|
||||
-o-transition-delay: 0.2s;
|
||||
-ms-transition-delay: 0.2s;
|
||||
transition-delay: 0.2s;
|
||||
-moz-transition: opacity 0.05s ease 0.05s;
|
||||
-webkit-transition: opacity 0.05s ease 0.05s;
|
||||
-o-transition: opacity 0.05s ease 0.05s;
|
||||
-ms-transition: opacity 0.05s ease 0.05s;
|
||||
transition: opacity 0.05s ease 0.05s;
|
||||
opacity:1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,6 +235,35 @@ var Editor = function(renderer, session) {
|
|||
return this.session;
|
||||
};
|
||||
|
||||
/** related to: Document.setValue
|
||||
* Editor.setValue(val [,dontSelect]) -> String
|
||||
* - val (String): The new value to set for the document
|
||||
* - cursorPos (number): 0: selectAll, -1 document start, 1 end
|
||||
*
|
||||
* Sets the current document to `val`.
|
||||
**/
|
||||
this.setValue = function(val, cursorPos) {
|
||||
this.session.doc.setValue(val);
|
||||
|
||||
if (!cursorPos)
|
||||
this.selectAll();
|
||||
else if (cursorPos == 1)
|
||||
this.navigateFileEnd();
|
||||
else if (cursorPos == -1)
|
||||
this.navigateFileStart();
|
||||
|
||||
return val;
|
||||
};
|
||||
|
||||
/** related to: EditSession.getValue
|
||||
* Editor.getValue() -> String
|
||||
*
|
||||
* Returns the current session's content.
|
||||
**/
|
||||
this.getValue = function() {
|
||||
return this.session.getValue();
|
||||
};
|
||||
|
||||
/**
|
||||
* Editor.getSelection() -> String
|
||||
*
|
||||
|
|
@ -249,8 +278,8 @@ var Editor = function(renderer, session) {
|
|||
*
|
||||
* {:VirtualRenderer.onResize}
|
||||
**/
|
||||
this.resize = function() {
|
||||
this.renderer.onResize();
|
||||
this.resize = function(force) {
|
||||
this.renderer.onResize(force);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -541,7 +570,7 @@ var Editor = function(renderer, session) {
|
|||
* Emitted when a breakpoint changes.
|
||||
**/
|
||||
this.onChangeBreakpoint = function() {
|
||||
this.renderer.setBreakpoints(this.session.getBreakpoints());
|
||||
this.renderer.updateBreakpoints();
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -57,9 +57,8 @@ function HashHandler(config, platform) {
|
|||
|
||||
this.commands[command.name] = command;
|
||||
|
||||
if (command.bindKey) {
|
||||
if (command.bindKey)
|
||||
this._buildKeyHash(command);
|
||||
}
|
||||
};
|
||||
|
||||
this.removeCommand = function(command) {
|
||||
|
|
@ -81,6 +80,10 @@ function HashHandler(config, platform) {
|
|||
this.bindKey = function(key, command) {
|
||||
if(!key)
|
||||
return;
|
||||
if (typeof command == "function") {
|
||||
this.addCommand({exec: command, bindKey: key, name: key});
|
||||
return;
|
||||
}
|
||||
|
||||
var ckb = this.commmandKeyBinding;
|
||||
key.split("|").forEach(function(keyPart) {
|
||||
|
|
|
|||
|
|
@ -119,7 +119,8 @@ var KeyBinding = function(editor) {
|
|||
else
|
||||
success = toExecute.passEvent != true;
|
||||
|
||||
if (success && e)
|
||||
// do not stop input events to not break repeating
|
||||
if (success && e && hashId != -1)
|
||||
event.stopEvent(e);
|
||||
|
||||
return success;
|
||||
|
|
|
|||
|
|
@ -108,7 +108,9 @@ exports.handler = {
|
|||
editor.removeListener("click", exports.onCursorMove);
|
||||
util.noMode(editor);
|
||||
util.currentMode = "normal";
|
||||
}
|
||||
},
|
||||
|
||||
actions: cmds.actions
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,18 +52,6 @@ var MOTION = 3;
|
|||
var ACTION = 4;
|
||||
var HMARGIN = 8; // Minimum amount of line separation between margins;
|
||||
|
||||
exports.searchStore = {
|
||||
current: "",
|
||||
options: {
|
||||
needle: "",
|
||||
backwards: false,
|
||||
wrap: true,
|
||||
caseSensitive: false,
|
||||
wholeWord: false,
|
||||
regExp: false
|
||||
}
|
||||
};
|
||||
|
||||
var repeat = function repeat(fn, count, args) {
|
||||
while (0 < count--)
|
||||
fn.apply(this, args);
|
||||
|
|
@ -88,7 +76,7 @@ var ensureScrollMargin = function(editor) {
|
|||
}
|
||||
};
|
||||
|
||||
var actions = {
|
||||
var actions = exports.actions = {
|
||||
"z": {
|
||||
param: true,
|
||||
fn: function(editor, range, count, param) {
|
||||
|
|
@ -288,16 +276,17 @@ var actions = {
|
|||
},
|
||||
":": {
|
||||
fn: function(editor, range, count, param) {
|
||||
editor.blur();
|
||||
txtConsoleInput.focus();
|
||||
txtConsoleInput.setValue(":");
|
||||
// not implemented
|
||||
}
|
||||
},
|
||||
"/": {
|
||||
fn: function(editor, range, count, param) {
|
||||
editor.blur();
|
||||
txtConsoleInput.focus();
|
||||
txtConsoleInput.setValue("/");
|
||||
// not implemented
|
||||
}
|
||||
},
|
||||
"?": {
|
||||
fn: function(editor, range, count, param) {
|
||||
// not implemented
|
||||
}
|
||||
},
|
||||
".": {
|
||||
|
|
|
|||
|
|
@ -72,11 +72,7 @@ var Gutter = function(parentEl) {
|
|||
};
|
||||
|
||||
this.removeGutterDecoration = function(row, className){
|
||||
this.$decorations[row] = this.$decorations[row].replace(" " + className, "");
|
||||
};
|
||||
|
||||
this.setBreakpoints = function(rows) {
|
||||
this.$breakpoints = rows.concat();
|
||||
this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
|
||||
};
|
||||
|
||||
this.setAnnotations = function(annotations) {
|
||||
|
|
@ -116,6 +112,7 @@ var Gutter = function(parentEl) {
|
|||
var fold = this.session.getNextFoldLine(i);
|
||||
var foldStart = fold ? fold.start.row : Infinity;
|
||||
var foldWidgets = this.$showFoldWidgets && this.session.foldWidgets;
|
||||
var breakpoints = this.session.$breakpoints;
|
||||
|
||||
while (true) {
|
||||
if(i > foldStart) {
|
||||
|
|
@ -129,10 +126,10 @@ var Gutter = function(parentEl) {
|
|||
var annotation = this.$annotations[i] || emptyAnno;
|
||||
html.push("<div class='ace_gutter-cell",
|
||||
this.$decorations[i] || "",
|
||||
this.$breakpoints[i] ? " ace_breakpoint " : " ",
|
||||
breakpoints[i] ? " ace_breakpoint " : " ",
|
||||
annotation.className,
|
||||
"' title='", annotation.text.join("\n"),
|
||||
"' style='height:", config.lineHeight, "px;'>", (i+1));
|
||||
"' style='height:", this.session.getRowLength(i) * config.lineHeight, "px;'>", (i+1));
|
||||
|
||||
if (foldWidgets) {
|
||||
var c = foldWidgets[i];
|
||||
|
|
@ -147,15 +144,18 @@ var Gutter = function(parentEl) {
|
|||
);
|
||||
}
|
||||
|
||||
var wrappedRowLength = this.session.getRowLength(i) - 1;
|
||||
while (wrappedRowLength--) {
|
||||
html.push("</div><div class='ace_gutter-cell' style='height:", config.lineHeight, "px'>\xA6");
|
||||
}
|
||||
|
||||
html.push("</div>");
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if (this.session.$useWrapMode)
|
||||
html.push(
|
||||
"<div class='ace_gutter-cell' style='pointer-events:none;opacity:0'>",
|
||||
this.session.getLength() - 1,
|
||||
"</div>"
|
||||
);
|
||||
|
||||
this.element = dom.setInnerHtml(this.element, html.join(""));
|
||||
this.element.style.height = config.minHeight + "px";
|
||||
|
||||
|
|
|
|||
|
|
@ -191,6 +191,10 @@ var ClojureHighlightRules = function() {
|
|||
}, {
|
||||
token : "string", // single line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||
}, {
|
||||
token : "string", // multi line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?$',
|
||||
next: "string"
|
||||
}, {
|
||||
token : "string", // symbol
|
||||
regex : "[:](?:[a-zA-Z]|\\d)+"
|
||||
|
|
@ -210,6 +214,17 @@ var ClojureHighlightRules = function() {
|
|||
merge : true,
|
||||
regex : ".+"
|
||||
}
|
||||
],
|
||||
"string" : [
|
||||
{
|
||||
token : "string",
|
||||
merge : true,
|
||||
regex : "\\\\."
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]*?"',
|
||||
next : "start"
|
||||
}
|
||||
]
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ var CSharpHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
regex : "\\/\\*",
|
||||
|
|
@ -95,7 +95,7 @@ var CSharpHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(CSharpHighlightRules, TextHighlightRules);
|
||||
|
|
|
|||
|
|
@ -119,6 +119,9 @@ define(function(require, exports, module) {
|
|||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
}
|
||||
oop.inherits(GolangHighlightRules, TextHighlightRules);
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ function GutterHandler(mouseHandler) {
|
|||
}
|
||||
|
||||
mouseHandler.captureMouse(e, "selectByLines");
|
||||
return e.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,16 +42,12 @@ define(function(require, exports, module) {
|
|||
"use strict";
|
||||
|
||||
var dom = require("../lib/dom");
|
||||
var BrowserFocus = require("../lib/browser_focus").BrowserFocus;
|
||||
|
||||
var useragent = require("../lib/useragent");
|
||||
|
||||
var DRAG_OFFSET = 5; // pixels
|
||||
|
||||
|
||||
|
||||
function DefaultHandlers(mouseHandler) {
|
||||
mouseHandler.$clickSelection = null;
|
||||
mouseHandler.browserFocus = new BrowserFocus();
|
||||
|
||||
var editor = mouseHandler.editor;
|
||||
editor.setDefaultHandler("mousedown", this.onMouseDown.bind(mouseHandler));
|
||||
|
|
@ -69,14 +65,16 @@ function DefaultHandlers(mouseHandler) {
|
|||
|
||||
mouseHandler.selectByLines = this.extendSelectionBy.bind(mouseHandler, "getLineRange");
|
||||
mouseHandler.selectByWords = this.extendSelectionBy.bind(mouseHandler, "getWordRange");
|
||||
|
||||
mouseHandler.$focusWaitTimout = 250;
|
||||
}
|
||||
|
||||
(function() {
|
||||
|
||||
this.onMouseDown = function(ev) {
|
||||
this.mousedownEvent = ev;
|
||||
var inSelection = ev.inSelection();
|
||||
var pos = ev.getDocumentPosition();
|
||||
this.mousedownEvent = ev;
|
||||
var editor = this.editor;
|
||||
var _self = this;
|
||||
|
||||
|
|
@ -99,7 +97,10 @@ function DefaultHandlers(mouseHandler) {
|
|||
// selection
|
||||
if (inSelection && !editor.isFocused()) {
|
||||
editor.focus();
|
||||
return;
|
||||
if (this.$focusWaitTimout && !this.$clickSelection) {
|
||||
// todo start select after focusWaitTimout passes
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!inSelection || this.$clickSelection || ev.getShiftKey()) {
|
||||
|
|
@ -116,7 +117,8 @@ function DefaultHandlers(mouseHandler) {
|
|||
}
|
||||
}
|
||||
|
||||
this.captureMouse(ev)
|
||||
this.captureMouse(ev);
|
||||
return ev.preventDefault();
|
||||
};
|
||||
|
||||
this.startSelect = function(pos) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ var Range = require("./range").Range;
|
|||
var Selection = require("./selection").Selection;
|
||||
var onMouseDown = require("./mouse/multi_select_handler").onMouseDown;
|
||||
var event = require("./lib/event");
|
||||
exports.commands = require("./commands/multi_select_commands");
|
||||
var commands = require("./commands/multi_select_commands");
|
||||
exports.commands = commands.defaultCommands.concat(commands.multiSelectCommands);
|
||||
|
||||
// Todo: session.find or editor.findVolatile that returns range
|
||||
var Search = require("./search").Search;
|
||||
|
|
@ -397,7 +398,7 @@ var Editor = require("./editor").Editor;
|
|||
this.inMultiSelectMode = true;
|
||||
|
||||
this.setStyle("multiselect");
|
||||
this.keyBinding.addKeyboardHandler(exports.commands.keyboardHandler);
|
||||
this.keyBinding.addKeyboardHandler(commands.keyboardHandler);
|
||||
this.commands.on("exec", this.$onMultiSelectExec);
|
||||
|
||||
this.renderer.updateCursor();
|
||||
|
|
@ -410,7 +411,7 @@ var Editor = require("./editor").Editor;
|
|||
this.inMultiSelectMode = false;
|
||||
|
||||
this.unsetStyle("multiselect");
|
||||
this.keyBinding.removeKeyboardHandler(exports.commands.keyboardHandler);
|
||||
this.keyBinding.removeKeyboardHandler(commands.keyboardHandler);
|
||||
|
||||
this.commands.removeEventListener("exec", this.$onMultiSelectExec);
|
||||
this.renderer.updateCursor();
|
||||
|
|
@ -420,6 +421,8 @@ var Editor = require("./editor").Editor;
|
|||
this.$onMultiSelectExec = function(e) {
|
||||
var command = e.command;
|
||||
var editor = e.editor;
|
||||
if (!editor.multiSelect)
|
||||
return;
|
||||
if (!command.multiSelectAction) {
|
||||
command.exec(editor, e.args || {});
|
||||
editor.multiSelect.addRange(editor.multiSelect.toOrientedRange());
|
||||
|
|
@ -724,7 +727,7 @@ function MultiSelect(editor) {
|
|||
editor.on("changeSession", exports.onSessionChange.bind(editor));
|
||||
|
||||
editor.on("mousedown", onMouseDown);
|
||||
editor.commands.addCommands(exports.commands.defaultCommands);
|
||||
editor.commands.addCommands(commands.defaultCommands);
|
||||
|
||||
addAltCursorListeners(editor);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ var Range = require("./range").Range;
|
|||
/**
|
||||
* new Selection(session)
|
||||
* - session (EditSession): The session to use
|
||||
*
|
||||
*
|
||||
* Creates a new `Selection` object.
|
||||
*
|
||||
**/
|
||||
|
|
@ -88,7 +88,7 @@ var Selection = function(session) {
|
|||
|
||||
/**
|
||||
* Selection.isEmpty() -> Boolean
|
||||
*
|
||||
*
|
||||
* Returns `true` if the selection is empty.
|
||||
**/
|
||||
this.isEmpty = function() {
|
||||
|
|
@ -100,7 +100,7 @@ var Selection = function(session) {
|
|||
|
||||
/**
|
||||
* Selection.isMultiLine() -> Boolean
|
||||
*
|
||||
*
|
||||
* Returns `true` if the selection is a multi-line.
|
||||
**/
|
||||
this.isMultiLine = function() {
|
||||
|
|
@ -113,7 +113,7 @@ var Selection = function(session) {
|
|||
|
||||
/**
|
||||
* Selection.getCursor() -> Number
|
||||
*
|
||||
*
|
||||
* Gets the current position of the cursor.
|
||||
**/
|
||||
this.getCursor = function() {
|
||||
|
|
@ -121,7 +121,7 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.setSelectionAnchor(row, column)
|
||||
* Selection.setSelectionAnchor(row, column)
|
||||
* - row (Number): The new row
|
||||
* - column (Number): The new column
|
||||
*
|
||||
|
|
@ -138,7 +138,7 @@ var Selection = function(session) {
|
|||
|
||||
/** related to: Anchor.getPosition
|
||||
* Selection.getSelectionAnchor() -> Object
|
||||
*
|
||||
*
|
||||
* Returns an object containing the `row` and `column` of the calling selection anchor.
|
||||
*
|
||||
**/
|
||||
|
|
@ -149,9 +149,9 @@ var Selection = function(session) {
|
|||
return this.anchor.getPosition();
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Selection.getSelectionLead() -> Object
|
||||
*
|
||||
*
|
||||
* Returns an object containing the `row` and `column` of the calling selection lead.
|
||||
**/
|
||||
this.getSelectionLead = function() {
|
||||
|
|
@ -159,9 +159,9 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.shiftSelection(columns)
|
||||
* Selection.shiftSelection(columns)
|
||||
* - columns (Number): The number of columns to shift by
|
||||
*
|
||||
*
|
||||
* Shifts the selection up (or down, if [[Selection.isBackwards `isBackwards()`]] is true) the given number of columns.
|
||||
*
|
||||
**/
|
||||
|
|
@ -188,7 +188,7 @@ var Selection = function(session) {
|
|||
|
||||
/**
|
||||
* Selection.isBackwards() -> Boolean
|
||||
*
|
||||
*
|
||||
* Returns `true` if the selection is going backwards in the document.
|
||||
**/
|
||||
this.isBackwards = function() {
|
||||
|
|
@ -199,7 +199,7 @@ var Selection = function(session) {
|
|||
|
||||
/**
|
||||
* Selection.getRange() -> Range
|
||||
*
|
||||
*
|
||||
* [Returns the [[Range `Range`]] for the selected text.]{: #Selection.getRange}
|
||||
**/
|
||||
this.getRange = function() {
|
||||
|
|
@ -218,8 +218,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.clearSelection()
|
||||
*
|
||||
* Selection.clearSelection()
|
||||
*
|
||||
* [Empties the selection (by de-selecting it). This function also emits the `'changeSelection'` event.]{: #Selection.clearSelection}
|
||||
**/
|
||||
this.clearSelection = function() {
|
||||
|
|
@ -230,24 +230,25 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectAll()
|
||||
*
|
||||
* Selection.selectAll()
|
||||
*
|
||||
* Selects all the text in the document.
|
||||
**/
|
||||
this.selectAll = function() {
|
||||
var lastRow = this.doc.getLength() - 1;
|
||||
this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length);
|
||||
this.moveCursorTo(0, 0);
|
||||
this.setSelectionAnchor(0, 0);
|
||||
this.moveCursorTo(lastRow, this.doc.getLine(lastRow).length);
|
||||
};
|
||||
|
||||
/**
|
||||
* Selection.setSelectionRange(range, reverse)
|
||||
* Selection.setSelectionRange(range, reverse)
|
||||
* - range (Range): The range of text to select
|
||||
* - reverse (Boolean): Indicates if the range should go backwards (`true`) or not
|
||||
*
|
||||
* Sets the selection to the provided range.
|
||||
*
|
||||
**/
|
||||
this.setRange =
|
||||
this.setSelectionRange = function(range, reverse) {
|
||||
if (reverse) {
|
||||
this.setSelectionAnchor(range.end.row, range.end.column);
|
||||
|
|
@ -268,7 +269,7 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectTo(row, column)
|
||||
* Selection.selectTo(row, column)
|
||||
* - row (Number): The row to select to
|
||||
* - column (Number): The column to select to
|
||||
*
|
||||
|
|
@ -282,9 +283,9 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectToPosition(pos)
|
||||
* Selection.selectToPosition(pos)
|
||||
* - pos (Object): An object containing the row and column
|
||||
*
|
||||
*
|
||||
* Moves the selection cursor to the row and column indicated by `pos`.
|
||||
*
|
||||
**/
|
||||
|
|
@ -295,8 +296,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectUp()
|
||||
*
|
||||
* Selection.selectUp()
|
||||
*
|
||||
* Moves the selection up one row.
|
||||
**/
|
||||
this.selectUp = function() {
|
||||
|
|
@ -304,8 +305,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectDown()
|
||||
*
|
||||
* Selection.selectDown()
|
||||
*
|
||||
* Moves the selection down one row.
|
||||
**/
|
||||
this.selectDown = function() {
|
||||
|
|
@ -313,8 +314,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectRight()
|
||||
*
|
||||
* Selection.selectRight()
|
||||
*
|
||||
* Moves the selection right one column.
|
||||
**/
|
||||
this.selectRight = function() {
|
||||
|
|
@ -322,8 +323,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectLeft()
|
||||
*
|
||||
* Selection.selectLeft()
|
||||
*
|
||||
* Moves the selection left one column.
|
||||
**/
|
||||
this.selectLeft = function() {
|
||||
|
|
@ -331,8 +332,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectLineStart()
|
||||
*
|
||||
* Selection.selectLineStart()
|
||||
*
|
||||
* Moves the selection to the beginning of the current line.
|
||||
**/
|
||||
this.selectLineStart = function() {
|
||||
|
|
@ -340,8 +341,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectLineEnd()
|
||||
*
|
||||
* Selection.selectLineEnd()
|
||||
*
|
||||
* Moves the selection to the end of the current line.
|
||||
**/
|
||||
this.selectLineEnd = function() {
|
||||
|
|
@ -349,8 +350,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectFileEnd()
|
||||
*
|
||||
* Selection.selectFileEnd()
|
||||
*
|
||||
* Moves the selection to the end of the file.
|
||||
**/
|
||||
this.selectFileEnd = function() {
|
||||
|
|
@ -358,8 +359,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectFileStart()
|
||||
*
|
||||
* Selection.selectFileStart()
|
||||
*
|
||||
* Moves the selection to the start of the file.
|
||||
**/
|
||||
this.selectFileStart = function() {
|
||||
|
|
@ -367,8 +368,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectWordRight()
|
||||
*
|
||||
* Selection.selectWordRight()
|
||||
*
|
||||
* Moves the selection to the first word on the right.
|
||||
**/
|
||||
this.selectWordRight = function() {
|
||||
|
|
@ -376,8 +377,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectWordLeft()
|
||||
*
|
||||
* Selection.selectWordLeft()
|
||||
*
|
||||
* Moves the selection to the first word on the left.
|
||||
**/
|
||||
this.selectWordLeft = function() {
|
||||
|
|
@ -385,8 +386,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/** related to: EditSession.getWordRange
|
||||
* Selection.selectWord()
|
||||
*
|
||||
* Selection.selectWord()
|
||||
*
|
||||
* Moves the selection to highlight the entire word.
|
||||
**/
|
||||
this.getWordRange = function(row, column) {
|
||||
|
|
@ -403,8 +404,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/** related to: EditSession.getAWordRange
|
||||
* Selection.selectAWord()
|
||||
*
|
||||
* Selection.selectAWord()
|
||||
*
|
||||
* Selects a word, including its right whitespace.
|
||||
**/
|
||||
this.selectAWord = function() {
|
||||
|
|
@ -430,9 +431,9 @@ var Selection = function(session) {
|
|||
return new Range(rowStart, 0, rowEnd + 1, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Selection.selectLine()
|
||||
*
|
||||
/**
|
||||
* Selection.selectLine()
|
||||
*
|
||||
* Selects the entire line.
|
||||
**/
|
||||
this.selectLine = function() {
|
||||
|
|
@ -440,8 +441,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorUp()
|
||||
*
|
||||
* Selection.moveCursorUp()
|
||||
*
|
||||
* Moves the cursor up one row.
|
||||
**/
|
||||
this.moveCursorUp = function() {
|
||||
|
|
@ -449,8 +450,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorDown()
|
||||
*
|
||||
* Selection.moveCursorDown()
|
||||
*
|
||||
* Moves the cursor down one row.
|
||||
**/
|
||||
this.moveCursorDown = function() {
|
||||
|
|
@ -458,8 +459,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorLeft()
|
||||
*
|
||||
* Selection.moveCursorLeft()
|
||||
*
|
||||
* Moves the cursor left one column.
|
||||
**/
|
||||
this.moveCursorLeft = function() {
|
||||
|
|
@ -484,8 +485,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorRight()
|
||||
*
|
||||
* Selection.moveCursorRight()
|
||||
*
|
||||
* Moves the cursor right one column.
|
||||
**/
|
||||
this.moveCursorRight = function() {
|
||||
|
|
@ -510,8 +511,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorLineStart()
|
||||
*
|
||||
* Selection.moveCursorLineStart()
|
||||
*
|
||||
* Moves the cursor to the start of the line.
|
||||
**/
|
||||
this.moveCursorLineStart = function() {
|
||||
|
|
@ -543,8 +544,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorLineEnd()
|
||||
*
|
||||
* Selection.moveCursorLineEnd()
|
||||
*
|
||||
* Moves the cursor to the end of the line.
|
||||
**/
|
||||
this.moveCursorLineEnd = function() {
|
||||
|
|
@ -558,8 +559,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorFileEnd()
|
||||
*
|
||||
* Selection.moveCursorFileEnd()
|
||||
*
|
||||
* Moves the cursor to the end of the file.
|
||||
**/
|
||||
this.moveCursorFileEnd = function() {
|
||||
|
|
@ -569,8 +570,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorFileStart()
|
||||
*
|
||||
* Selection.moveCursorFileStart()
|
||||
*
|
||||
* Moves the cursor to the start of the file.
|
||||
**/
|
||||
this.moveCursorFileStart = function() {
|
||||
|
|
@ -578,8 +579,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorLongWordRight()
|
||||
*
|
||||
* Selection.moveCursorLongWordRight()
|
||||
*
|
||||
* Moves the cursor to the word on the right.
|
||||
**/
|
||||
this.moveCursorLongWordRight = function() {
|
||||
|
|
@ -598,14 +599,14 @@ var Selection = function(session) {
|
|||
this.moveCursorTo(fold.end.row, fold.end.column);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// first skip space
|
||||
if (match = this.session.nonTokenRe.exec(rightOfCursor)) {
|
||||
column += this.session.nonTokenRe.lastIndex;
|
||||
this.session.nonTokenRe.lastIndex = 0;
|
||||
rightOfCursor = line.substring(column);
|
||||
}
|
||||
|
||||
|
||||
// if at line end proceed with next line
|
||||
if (column >= line.length) {
|
||||
this.moveCursorTo(row, line.length);
|
||||
|
|
@ -614,7 +615,7 @@ var Selection = function(session) {
|
|||
this.moveCursorWordRight();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// advance to the end of the next token
|
||||
if (match = this.session.tokenRe.exec(rightOfCursor)) {
|
||||
column += this.session.tokenRe.lastIndex;
|
||||
|
|
@ -625,8 +626,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorLongWordLeft()
|
||||
*
|
||||
* Selection.moveCursorLongWordLeft()
|
||||
*
|
||||
* Moves the cursor to the word on the left.
|
||||
**/
|
||||
this.moveCursorLongWordLeft = function() {
|
||||
|
|
@ -644,19 +645,19 @@ var Selection = function(session) {
|
|||
if (str == null) {
|
||||
str = this.doc.getLine(row).substring(0, column)
|
||||
}
|
||||
|
||||
|
||||
var leftOfCursor = lang.stringReverse(str);
|
||||
var match;
|
||||
this.session.nonTokenRe.lastIndex = 0;
|
||||
this.session.tokenRe.lastIndex = 0;
|
||||
|
||||
|
||||
// skip whitespace
|
||||
if (match = this.session.nonTokenRe.exec(leftOfCursor)) {
|
||||
column -= this.session.nonTokenRe.lastIndex;
|
||||
leftOfCursor = leftOfCursor.slice(this.session.nonTokenRe.lastIndex);
|
||||
this.session.nonTokenRe.lastIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
// if at begin of the line proceed in line above
|
||||
if (column <= 0) {
|
||||
this.moveCursorTo(row, 0);
|
||||
|
|
@ -762,7 +763,7 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/** related to: EditSession.documentToScreenPosition
|
||||
* Selection.moveCursorBy(rows, chars)
|
||||
* Selection.moveCursorBy(rows, chars)
|
||||
* - rows (Number): The number of rows to move by
|
||||
* - chars (Number): The number of characters to move by
|
||||
*
|
||||
|
|
@ -788,9 +789,9 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorToPosition(position)
|
||||
* Selection.moveCursorToPosition(position)
|
||||
* - position (Object): The position to move to
|
||||
*
|
||||
*
|
||||
* Moves the selection to the position indicated by its `row` and `column`.
|
||||
**/
|
||||
this.moveCursorToPosition = function(position) {
|
||||
|
|
@ -798,7 +799,7 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorTo(row, column, keepDesiredColumn)
|
||||
* Selection.moveCursorTo(row, column, keepDesiredColumn)
|
||||
* - row (Number): The row to move to
|
||||
* - column (Number): The column to move to
|
||||
* - keepDesiredColumn (Boolean): [If `true`, the cursor move does not respect the previous column]{: #preventUpdateBool}
|
||||
|
|
@ -822,7 +823,7 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorToScreen(row, column, keepDesiredColumn)
|
||||
* Selection.moveCursorToScreen(row, column, keepDesiredColumn)
|
||||
* - row (Number): The row to move to
|
||||
* - column (Number): The column to move to
|
||||
* - keepDesiredColumn (Boolean): {:preventUpdateBool}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ var log = document.getElementById("log")
|
|||
|
||||
var testNames = [
|
||||
"ace/anchor_test",
|
||||
"ace/background_tokenizer_test",
|
||||
"ace/commands/command_manager_test",
|
||||
"ace/document_test",
|
||||
"ace/edit_session_test",
|
||||
|
|
@ -65,7 +66,11 @@ if (location.search)
|
|||
testNames = location.search.substr(1).split(",")
|
||||
|
||||
require(testNames, function() {
|
||||
var tests = testNames.map(require);
|
||||
var tests = testNames.map(function(x) {
|
||||
var module = require(x);
|
||||
module.href = x;
|
||||
return module;
|
||||
});
|
||||
|
||||
async.list(tests)
|
||||
.expand(function(test) {
|
||||
|
|
@ -73,6 +78,12 @@ require(testNames, function() {
|
|||
}, AsyncTest.TestGenerator)
|
||||
.run()
|
||||
.each(function(test, next) {
|
||||
if (test.index == 1 && test.context.href) {
|
||||
var href = test.context.href;
|
||||
var node = document.createElement("div");
|
||||
node.innerHTML = "<a href='?" + href + "'>" + href.replace(/^ace\//, "") + "</a>";
|
||||
log.appendChild(node);
|
||||
}
|
||||
var node = document.createElement("div");
|
||||
node.className = test.passed ? "passed" : "failed";
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ MockRenderer.prototype.updateBackMarkers = function() {
|
|||
MockRenderer.prototype.updateFrontMarkers = function() {
|
||||
};
|
||||
|
||||
MockRenderer.prototype.setBreakpoints = function() {
|
||||
MockRenderer.prototype.updateBreakpoints = function() {
|
||||
};
|
||||
|
||||
MockRenderer.prototype.onResize = function() {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ dom.importCssString(editorCss, "ace_editor");
|
|||
|
||||
/**
|
||||
* new VirtualRenderer(container, theme)
|
||||
* - container (DOMElement): The root element of the editor
|
||||
* - container (DOMElement): The root element of the editor
|
||||
* - theme (String): The starting theme
|
||||
*
|
||||
* Constructs a new `VirtualRenderer` within the `container` specified, applying the given `theme`.
|
||||
|
|
@ -82,7 +82,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
// TODO: this breaks rendering in Cloud9 with multiple ace instances
|
||||
// // Imports CSS once per DOM document ('ace_editor' serves as an identifier).
|
||||
// dom.importCssString(editorCss, "ace_editor", container.ownerDocument);
|
||||
|
||||
|
||||
// in IE <= 9 the native cursor always shines through
|
||||
this.$keepTextAreaAtCursor = !useragent.isIE;
|
||||
|
||||
|
|
@ -102,7 +102,6 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.content.className = "ace_content";
|
||||
this.scroller.appendChild(this.content);
|
||||
|
||||
this.setHighlightGutterLine(true);
|
||||
this.$gutterLayer = new GutterLayer(this.$gutter);
|
||||
this.$gutterLayer.on("changeGutterWidth", this.onResize.bind(this, true));
|
||||
this.setFadeFoldWidgets(true);
|
||||
|
|
@ -449,31 +448,38 @@ var VirtualRenderer = function(container, theme) {
|
|||
dom.removeCssClass(this.$gutter, "ace_fade-fold-widgets");
|
||||
};
|
||||
|
||||
this.$highlightGutterLine = false;
|
||||
this.$highlightGutterLine = true;
|
||||
this.setHighlightGutterLine = function(shouldHighlight) {
|
||||
if (this.$highlightGutterLine == shouldHighlight)
|
||||
return;
|
||||
this.$highlightGutterLine = shouldHighlight;
|
||||
|
||||
|
||||
if (!this.$gutterLineHighlight) {
|
||||
this.$gutterLineHighlight = dom.createElement("div");
|
||||
this.$gutterLineHighlight.className = "ace_gutter_active_line";
|
||||
this.$gutter.appendChild(this.$gutterLineHighlight);
|
||||
return;
|
||||
}
|
||||
|
||||
this.$gutterLineHighlight.style.display = shouldHighlight ? "" : "none";
|
||||
this.$updateGutterLineHighlight();
|
||||
this.$loop.schedule(this.CHANGE_GUTTER);
|
||||
};
|
||||
|
||||
this.getHighlightGutterLine = function() {
|
||||
return this.$highlightGutterLine;
|
||||
};
|
||||
|
||||
this.$updateGutterLineHighlight = function() {
|
||||
this.$gutterLineHighlight.style.top = this.$cursorLayer.$pixelPos.top - this.layerConfig.offset + "px";
|
||||
this.$gutterLineHighlight.style.height = this.layerConfig.lineHeight + "px";
|
||||
this.$updateGutterLineHighlight = function(gutterReady) {
|
||||
var i = this.session.selection.lead.row;
|
||||
if (i == this.$gutterLineHighlight)
|
||||
return;
|
||||
|
||||
if (!gutterReady) {
|
||||
var ch = this.$gutterLayer.element.children
|
||||
var oldEl = ch[this.$gutterLineHighlight - this.layerConfig.firstRow];
|
||||
if (oldEl)
|
||||
dom.removeCssClass(oldEl, "ace_gutter_active_line");
|
||||
|
||||
var newEl = ch[i - this.layerConfig.firstRow];
|
||||
if (newEl)
|
||||
dom.addCssClass(newEl, "ace_gutter_active_line");
|
||||
}
|
||||
|
||||
this.$gutterLayer.removeGutterDecoration(this.$gutterLineHighlight, "ace_gutter_active_line");
|
||||
this.$gutterLayer.addGutterDecoration(i, "ace_gutter_active_line");
|
||||
this.$gutterLineHighlight = i;
|
||||
};
|
||||
|
||||
this.$updatePrintMargin = function() {
|
||||
|
|
@ -667,13 +673,15 @@ var VirtualRenderer = function(container, theme) {
|
|||
// update scrollbar first to not lose scroll position when gutter calls resize
|
||||
this.$updateScrollBar();
|
||||
this.$textLayer.update(this.layerConfig);
|
||||
if (this.showGutter)
|
||||
if (this.showGutter) {
|
||||
if (this.$highlightGutterLine)
|
||||
this.$updateGutterLineHighlight(true);
|
||||
this.$gutterLayer.update(this.layerConfig);
|
||||
}
|
||||
this.$markerBack.update(this.layerConfig);
|
||||
this.$markerFront.update(this.layerConfig);
|
||||
this.$cursorLayer.update(this.layerConfig);
|
||||
this.$moveTextAreaToCursor();
|
||||
this.$highlightGutterLine && this.$updateGutterLineHighlight();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -685,13 +693,15 @@ var VirtualRenderer = function(container, theme) {
|
|||
else
|
||||
this.$textLayer.scrollLines(this.layerConfig);
|
||||
|
||||
if (this.showGutter)
|
||||
if (this.showGutter) {
|
||||
if (this.$highlightGutterLine)
|
||||
this.$updateGutterLineHighlight(true);
|
||||
this.$gutterLayer.update(this.layerConfig);
|
||||
}
|
||||
this.$markerBack.update(this.layerConfig);
|
||||
this.$markerFront.update(this.layerConfig);
|
||||
this.$cursorLayer.update(this.layerConfig);
|
||||
this.$moveTextAreaToCursor();
|
||||
this.$highlightGutterLine && this.$updateGutterLineHighlight();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -714,7 +724,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
if (changes & this.CHANGE_CURSOR) {
|
||||
this.$cursorLayer.update(this.layerConfig);
|
||||
this.$moveTextAreaToCursor();
|
||||
this.$highlightGutterLine && this.$updateGutterLineHighlight();
|
||||
this.$highlightGutterLine && this.$updateGutterLineHighlight(false);
|
||||
}
|
||||
|
||||
if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) {
|
||||
|
|
@ -810,10 +820,6 @@ var VirtualRenderer = function(container, theme) {
|
|||
|
||||
var layerConfig = this.layerConfig;
|
||||
|
||||
// if the update changes the width of the document do a full redraw
|
||||
if (layerConfig.width != this.$getLongestLine())
|
||||
return this.$textLayer.update(layerConfig);
|
||||
|
||||
if (firstRow > layerConfig.lastRow + 1) { return; }
|
||||
if (lastRow < layerConfig.firstRow) { return; }
|
||||
|
||||
|
|
@ -883,13 +889,11 @@ var VirtualRenderer = function(container, theme) {
|
|||
};
|
||||
|
||||
/**
|
||||
* VirtualRenderer.setBreakpoints(rows) -> Void
|
||||
* - rows (Array): An array containg row numbers
|
||||
* VirtualRenderer.updateBreakpoints() -> Void
|
||||
*
|
||||
* Sets a breakpoint for every row number indicated on `rows`.
|
||||
* Redraw breakpoints.
|
||||
**/
|
||||
this.setBreakpoints = function(rows) {
|
||||
this.$gutterLayer.setBreakpoints(rows);
|
||||
this.updateBreakpoints = function(rows) {
|
||||
this.$loop.schedule(this.CHANGE_GUTTER);
|
||||
};
|
||||
|
||||
|
|
@ -1045,13 +1049,13 @@ var VirtualRenderer = function(container, theme) {
|
|||
return steps;
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* VirtualRenderer.scrollToLine(line, center, animate, callback) -> Void
|
||||
* - line (Number): A line number
|
||||
* - center (Boolean): If `true`, centers the editor the to indicated line
|
||||
* - animate (Boolean): If `true` animates scrolling
|
||||
* - callback (Function): Function to be called after the animation has finished
|
||||
*
|
||||
*
|
||||
* Gracefully scrolls the editor to the row indicated.
|
||||
**/
|
||||
this.scrollToLine = function(line, center, animate, callback) {
|
||||
|
|
@ -1072,7 +1076,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
var _self = this;
|
||||
var steps = _self.$calcSteps(fromValue, toValue);
|
||||
this.$inScrollAnimation = true;
|
||||
|
||||
|
||||
clearInterval(this.$timer);
|
||||
|
||||
_self.session.setScrollTop(steps.shift());
|
||||
|
|
@ -1081,18 +1085,20 @@ var VirtualRenderer = function(container, theme) {
|
|||
_self.session.setScrollTop(steps.shift());
|
||||
// trick session to think it's already scrolled to not loose toValue
|
||||
_self.session.$scrollTop = toValue;
|
||||
} else {
|
||||
_self.$inScrollAnimation = false;
|
||||
clearInterval(_self.$timer);
|
||||
|
||||
} else if (toValue != null) {
|
||||
_self.session.$scrollTop = -1;
|
||||
_self.session.setScrollTop(toValue);
|
||||
toValue = null;
|
||||
} else {
|
||||
// do this on separate step to not get spurious scroll event from scrollbar
|
||||
_self.$timer = clearInterval(_self.$timer);
|
||||
_self.$inScrollAnimation = false;
|
||||
callback && callback();
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* VirtualRenderer.scrollToY(scrollTop) -> Number
|
||||
* - scrollTop (Number): The position to scroll to
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue