Static highlighting fix for codesnippets

This commit is contained in:
Jan Jongboom 2011-12-29 10:36:22 +00:00
commit f283d34790
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

@ -51,7 +51,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);
@ -71,8 +73,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>");
}