From 727c94c90a4f87f9a0f2e063b2ec09f2b3e1f2fd Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 20 Nov 2013 18:33:40 +0400 Subject: [PATCH 1/2] cleanup --- lib/ace/lib/oop.js | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/lib/ace/lib/oop.js b/lib/ace/lib/oop.js index 104e8290..85725f0f 100644 --- a/lib/ace/lib/oop.js +++ b/lib/ace/lib/oop.js @@ -31,28 +31,17 @@ define(function(require, exports, module) { "use strict"; -exports.inherits = (function() { - var createObject = Object.create || function(prototype, properties) { - var Type = function () {}; - Type.prototype = prototype; - object = new Type(); - object.__proto__ = prototype; - if (typeof properties !== 'undefined' && Object.defineProperties) { - Object.defineProperties(object, properties); +exports.inherits = function(ctor, superCtor) { + ctor.super_ = superCtor; + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true } - }; - return function(ctor, superCtor) { - ctor.super_ = superCtor; - ctor.prototype = createObject(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -}()); + }); +}; exports.mixin = function(obj, mixin) { for (var key in mixin) { From b42ce65a54326fee1d72373488f6da67ae609c39 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 17 Nov 2013 16:30:57 +0400 Subject: [PATCH 2/2] use css counter for static highlight gutter --- lib/ace/ext/static.css | 11 ++++++++++- lib/ace/ext/static_highlight.js | 4 ++-- lib/ace/ext/static_highlight_test.js | 14 +++++++------- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/lib/ace/ext/static.css b/lib/ace/ext/static.css index bd479780..f82359da 100644 --- a/lib/ace/ext/static.css +++ b/lib/ace/ext/static.css @@ -20,4 +20,13 @@ -khtml-user-select: none; -webkit-user-select: none; user-select: none; -} \ No newline at end of file +} + + +.ace_static_highlight .ace_gutter-cell:before { + content: counter(ace_line, decimal); + counter-increment: ace_line; +} +.ace_static_highlight { + counter-reset: ace_line; +} diff --git a/lib/ace/ext/static_highlight.js b/lib/ace/ext/static_highlight.js index 56588f14..a3461424 100644 --- a/lib/ace/ext/static_highlight.js +++ b/lib/ace/ext/static_highlight.js @@ -160,14 +160,14 @@ highlight.renderSync = function(input, mode, theme, lineStart, disableGutter) { for(var ix = 0; ix < length; ix++) { stringBuilder.push("
"); if (!disableGutter) - stringBuilder.push("" + (ix + lineStart) + ""); + stringBuilder.push("" + /*(ix + lineStart) + */ ""); textLayer.$renderLine(stringBuilder, ix, true, false); stringBuilder.push("\n
"); } // let's prepare the whole html var html = "
" + - "
" + + "
" + stringBuilder.join("") + "
" + "
"; diff --git a/lib/ace/ext/static_highlight_test.js b/lib/ace/ext/static_highlight_test.js index 63f0ebc3..075cea7b 100644 --- a/lib/ace/ext/static_highlight_test.js +++ b/lib/ace/ext/static_highlight_test.js @@ -28,13 +28,13 @@ module.exports = { var mode = new JavaScriptMode(); var result = highlighter.render(snippet, mode, theme); - assert.equal(result.html, "
" - + "
1/**\xa0this\xa0is\xa0a\xa0function\n
" - + "
2*\n
" - + "
3*/\n
" - + "
4function\xa0hello\xa0(a,\xa0b,\xa0c)\xa0{\n
" - + "
5\xa0\xa0\xa0\xa0console.log(a\xa0*\xa0b\xa0+\xa0c\xa0+\xa0'sup$');\n
" - + "
6}\n
" + assert.equal(result.html, "
" + + "
/**\xa0this\xa0is\xa0a\xa0function\n
" + + "
*\n
" + + "
*/\n
" + + "
function\xa0hello\xa0(a,\xa0b,\xa0c)\xa0{\n
" + + "
\xa0\xa0\xa0\xa0console.log(a\xa0*\xa0b\xa0+\xa0c\xa0+\xa0'sup$');\n
" + + "
}\n
" + "
"); assert.ok(!!result.css); next();