diff --git a/edit.html b/edit.html index 8e06dc9d..f905f882 100644 --- a/edit.html +++ b/edit.html @@ -93,6 +93,12 @@ #url:not([href^="http"]) { display: none; } + img[src*="world"] { + width: 16px; + height: 16px; + vertical-align: middle; + image-rendering: -webkit-optimize-contrast; + } #enabled { margin-left: 0; vertical-align: middle; diff --git a/edit.js b/edit.js index 56e93243..ef3f9228 100644 --- a/edit.js +++ b/edit.js @@ -579,6 +579,9 @@ function setupGlobalSearch() { if (cm.state.search) { return cm.state.search; } + if (!curState) { + return null; + } newState = curState; } cm.state.search = { @@ -848,30 +851,32 @@ function updateLintReport(cm, delay) { } // user is editing right now: postpone updating the report for the new issues (default: 500ms lint + 4500ms) // or update it as soon as possible (default: 500ms lint + 100ms) in case an existing issue was just fixed - var postponeNewIssues = delay == undefined; var state = cm.state.lint; clearTimeout(state.reportTimeout); state.reportTimeout = setTimeout(update.bind(cm), state.options.delay + 100); + state.postponeNewIssues = delay == undefined || delay == null; function update() { // this == cm var scope = this ? [this] : editors; var changed = false; var fixedOldIssues = false; scope.forEach(function(cm) { - var oldMarkers = cm.state.lint.markedLast || {}; + var state = cm.state.lint; + var oldMarkers = state.markedLast || {}; var newMarkers = {}; - var html = cm.state.lint.marked.length == 0 ? "" : "" + - cm.state.lint.marked.map(function(mark) { + var html = state.marked.length == 0 ? "" : "" + + state.marked.map(function(mark) { var info = mark.__annotation; - var pos = info.from.line + "," + info.from.ch; - if (oldMarkers[pos] == info.message) { - delete oldMarkers[pos]; - } - newMarkers[pos] = info.message; + var isActiveLine = info.from.line == cm.getCursor().line; + var pos = isActiveLine ? "cursor" : (info.from.line + "," + info.from.ch); var message = escapeHtml(info.message.replace(/ at line \d.+$/, "")); if (message.length > 100) { message = message.substr(0, 100) + "..."; } + if (isActiveLine || oldMarkers[pos] == message) { + delete oldMarkers[pos]; + } + newMarkers[pos] = message; return "" + "" + info.severity + "" + @@ -880,16 +885,16 @@ function updateLintReport(cm, delay) { "" + (info.from.ch+1) + "" + "" + message + ""; }).join("") + ""; - cm.state.lint.markedLast = newMarkers; - fixedOldIssues |= Object.keys(oldMarkers).length > 0; - if (cm.state.lint.html != html) { - cm.state.lint.html = html; + state.markedLast = newMarkers; + fixedOldIssues |= state.reportDisplayed && Object.keys(oldMarkers).length > 0; + if (state.html != html) { + state.html = html; changed = true; } }); if (changed) { clearTimeout(state ? state.renderTimeout : undefined); - if (!postponeNewIssues || fixedOldIssues) { + if (!state || !state.postponeNewIssues || fixedOldIssues) { renderLintReport(true); } else { state.renderTimeout = setTimeout(function() { @@ -904,7 +909,7 @@ function updateLintReport(cm, delay) { } } -function renderLintReport(blockChanged) { +function renderLintReport(someBlockChanged) { var container = document.getElementById("lint"); var content = container.children[1]; var label = t("sectionCode"); @@ -915,13 +920,14 @@ function renderLintReport(blockChanged) { var html = "" + label + " " + (index+1) + "" + cm.state.lint.html; newBlock.innerHTML = html; newBlock.cm = cm; - if (!blockChanged) { - var block = content.children[newContent.children.length - 1]; - blockChanged = !block || cm != block.cm || html != block.innerHTML; - } + + var block = content.children[newContent.children.length - 1]; + blockChanged = !block || cm != block.cm || html != block.innerHTML; + someBlockChanged |= blockChanged; + cm.state.lint.reportDisplayed = blockChanged; } }); - if (blockChanged || newContent.children.length != content.children.length) { + if (someBlockChanged || newContent.children.length != content.children.length) { container.replaceChild(newContent, content); container.style.display = newContent.children.length ? "block" : "none"; resizeLintReport(null, newContent); diff --git a/manage.html b/manage.html index b7052de5..37af1467 100644 --- a/manage.html +++ b/manage.html @@ -43,6 +43,12 @@ width: 100%; height: 2px; background-color: #fff; } + img[src*="world"] { + width: 16px; + height: 16px; + vertical-align: middle; + image-rendering: -webkit-optimize-contrast; + } .applies-to { word-break: break-word; } diff --git a/world_go.png b/world_go.png index f738522f..da1c7701 100644 Binary files a/world_go.png and b/world_go.png differ