Skip to content
Browse files

fix coffeescript highlighting

  • Loading branch information...
1 parent 114724f commit 5e28f51e8297c8d542ea98f189ff239c6681cb9c @nightwing nightwing committed Jul 19, 2012
Showing with 13 additions and 10 deletions.
  1. +11 −6 chrome/content/ace++/consoleMode.js
  2. +2 −4 chrome/content/ace++/res/ace/ace.js
View
17 chrome/content/ace++/consoleMode.js
@@ -77,9 +77,10 @@ modes = {
js: new jsMode,
get coffee() {
var req = window.require, def = window.define
- require(["ace/mode/coffee", "res/coffee-script"], function(){
- var cf = require("ace/mode/coffee").Mode
- modes.coffee = new cf
+ require(["res/coffee-script"], function(){
+ var cf = require("ace/mode/coffee").Mode
+ modes.coffee = new cf
+
coffeeScriptCompiler = this.CoffeeScript
// now that we have real coffee, highlight session
// relies on global editor
@@ -109,7 +110,11 @@ function testLang(lang, fullName){
}
return true
}
-
+var states = {}
+var $getState = function(state, lang, isHeader){
+ var g = lang + state + isHeader
+ return states[g] || (states[g] = {state:state, lang:lang, isHeader:isHeader})
+}
tk.getLineTokens = function(line, startState) {
var match,lang,isHeader = 0;
if (typeof startState == 'object') {
@@ -140,12 +145,12 @@ tk.getLineTokens = function(line, startState) {
}
ans = {
tokens : tok,
- state : {state:"start", lang:lang, isHeader:isHeader + 1}
+ state : $getState("start", lang, isHeader + 1)
};
}
else {
var ans = (modes[lang]||jsMode).$tokenizer.getLineTokens(line, startState)
- ans.state = {lang: lang, state: ans.state}
+ ans.state = $getState(ans.state, lang)
}
return ans
};
View
6 chrome/content/ace++/res/ace/ace.js
@@ -10016,7 +10016,6 @@ var Gutter = function(parentEl) {
this.update = function(config) {
this.$config = config;
- var emptyAnno = {className: "", text: []};
var breakpoints = this.session.$breakpoints;
var html = [];
var i = config.firstRow;
@@ -10035,12 +10034,11 @@ var Gutter = function(parentEl) {
if(i > lastRow)
break;
- var annotation = this.$annotations[i] || emptyAnno;
+ var annotation = this.$annotations[i];
html.push("<div class='ace_gutter-cell",
this.$decorations[i] || "",
breakpoints[i] ? " ace_breakpoint " + breakpoints[i] : " ",
- annotation.className,
- "' title='", annotation.text.join("\n"),
+ annotation ? (annotation.className + "' title='" + annotation.text.join("\n")) : "",
"' style='height:", this.session.getRowLength(i) * config.lineHeight, "px;'>", i);
if (foldWidgets) {

0 comments on commit 5e28f51

Please sign in to comment.
Something went wrong with that request. Please try again.