Merge pull request #597 from ajaxorg/code-snippets

Static highlighting fix for codesnippets
This commit is contained in:
Zef Hemel 2011-12-29 02:40:48 -08:00
commit 3d812115ed
2 changed files with 6 additions and 4 deletions

View file

@ -12,7 +12,7 @@
margin-right: 3px;
}
.ace-row { clear: both; }
.ace_line { clear: both; }
*.ace_gutter-cell {
-moz-user-select: -moz-none;

View file

@ -52,7 +52,9 @@ var baseStyles = require("../requirejs/text!./static.css");
* @returns {object} An object containing: html, css
*/
exports.render = function(input, mode, theme) {
exports.render = function(input, mode, theme, lineStart) {
lineStart = parseInt(lineStart || 1, 10);
var session = new EditSession("");
session.setMode(mode);
session.setUseWorker(false);
@ -72,8 +74,8 @@ exports.render = function(input, mode, theme) {
for(var ix = 0; ix < length; ix++) {
var lineTokens = tokens[ix].tokens;
stringBuilder.push("<div class='ace-row'>");
stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix+1) + "</span>");
stringBuilder.push("<div class='ace_line'>");
stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix + lineStart) + "</span>");
textLayer.$renderLine(stringBuilder, 0, lineTokens, true);
stringBuilder.push("</div>");
}