commit
8ab8a1ee26
|
@ -93,6 +93,12 @@
|
||||||
#url:not([href^="http"]) {
|
#url:not([href^="http"]) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
img[src*="world"] {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
vertical-align: middle;
|
||||||
|
image-rendering: -webkit-optimize-contrast;
|
||||||
|
}
|
||||||
#enabled {
|
#enabled {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
|
42
edit.js
42
edit.js
|
@ -579,6 +579,9 @@ function setupGlobalSearch() {
|
||||||
if (cm.state.search) {
|
if (cm.state.search) {
|
||||||
return cm.state.search;
|
return cm.state.search;
|
||||||
}
|
}
|
||||||
|
if (!curState) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
newState = curState;
|
newState = curState;
|
||||||
}
|
}
|
||||||
cm.state.search = {
|
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)
|
// 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
|
// 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;
|
var state = cm.state.lint;
|
||||||
clearTimeout(state.reportTimeout);
|
clearTimeout(state.reportTimeout);
|
||||||
state.reportTimeout = setTimeout(update.bind(cm), state.options.delay + 100);
|
state.reportTimeout = setTimeout(update.bind(cm), state.options.delay + 100);
|
||||||
|
state.postponeNewIssues = delay == undefined || delay == null;
|
||||||
|
|
||||||
function update() { // this == cm
|
function update() { // this == cm
|
||||||
var scope = this ? [this] : editors;
|
var scope = this ? [this] : editors;
|
||||||
var changed = false;
|
var changed = false;
|
||||||
var fixedOldIssues = false;
|
var fixedOldIssues = false;
|
||||||
scope.forEach(function(cm) {
|
scope.forEach(function(cm) {
|
||||||
var oldMarkers = cm.state.lint.markedLast || {};
|
var state = cm.state.lint;
|
||||||
|
var oldMarkers = state.markedLast || {};
|
||||||
var newMarkers = {};
|
var newMarkers = {};
|
||||||
var html = cm.state.lint.marked.length == 0 ? "" : "<tbody>" +
|
var html = state.marked.length == 0 ? "" : "<tbody>" +
|
||||||
cm.state.lint.marked.map(function(mark) {
|
state.marked.map(function(mark) {
|
||||||
var info = mark.__annotation;
|
var info = mark.__annotation;
|
||||||
var pos = info.from.line + "," + info.from.ch;
|
var isActiveLine = info.from.line == cm.getCursor().line;
|
||||||
if (oldMarkers[pos] == info.message) {
|
var pos = isActiveLine ? "cursor" : (info.from.line + "," + info.from.ch);
|
||||||
delete oldMarkers[pos];
|
|
||||||
}
|
|
||||||
newMarkers[pos] = info.message;
|
|
||||||
var message = escapeHtml(info.message.replace(/ at line \d.+$/, ""));
|
var message = escapeHtml(info.message.replace(/ at line \d.+$/, ""));
|
||||||
if (message.length > 100) {
|
if (message.length > 100) {
|
||||||
message = message.substr(0, 100) + "...";
|
message = message.substr(0, 100) + "...";
|
||||||
}
|
}
|
||||||
|
if (isActiveLine || oldMarkers[pos] == message) {
|
||||||
|
delete oldMarkers[pos];
|
||||||
|
}
|
||||||
|
newMarkers[pos] = message;
|
||||||
return "<tr class='" + info.severity + "'>" +
|
return "<tr class='" + info.severity + "'>" +
|
||||||
"<td role='severity' class='CodeMirror-lint-marker-" + info.severity + "'>" +
|
"<td role='severity' class='CodeMirror-lint-marker-" + info.severity + "'>" +
|
||||||
info.severity + "</td>" +
|
info.severity + "</td>" +
|
||||||
|
@ -880,16 +885,16 @@ function updateLintReport(cm, delay) {
|
||||||
"<td role='col'>" + (info.from.ch+1) + "</td>" +
|
"<td role='col'>" + (info.from.ch+1) + "</td>" +
|
||||||
"<td role='message'>" + message + "</td></tr>";
|
"<td role='message'>" + message + "</td></tr>";
|
||||||
}).join("") + "</tbody>";
|
}).join("") + "</tbody>";
|
||||||
cm.state.lint.markedLast = newMarkers;
|
state.markedLast = newMarkers;
|
||||||
fixedOldIssues |= Object.keys(oldMarkers).length > 0;
|
fixedOldIssues |= state.reportDisplayed && Object.keys(oldMarkers).length > 0;
|
||||||
if (cm.state.lint.html != html) {
|
if (state.html != html) {
|
||||||
cm.state.lint.html = html;
|
state.html = html;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (changed) {
|
if (changed) {
|
||||||
clearTimeout(state ? state.renderTimeout : undefined);
|
clearTimeout(state ? state.renderTimeout : undefined);
|
||||||
if (!postponeNewIssues || fixedOldIssues) {
|
if (!state || !state.postponeNewIssues || fixedOldIssues) {
|
||||||
renderLintReport(true);
|
renderLintReport(true);
|
||||||
} else {
|
} else {
|
||||||
state.renderTimeout = setTimeout(function() {
|
state.renderTimeout = setTimeout(function() {
|
||||||
|
@ -904,7 +909,7 @@ function updateLintReport(cm, delay) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderLintReport(blockChanged) {
|
function renderLintReport(someBlockChanged) {
|
||||||
var container = document.getElementById("lint");
|
var container = document.getElementById("lint");
|
||||||
var content = container.children[1];
|
var content = container.children[1];
|
||||||
var label = t("sectionCode");
|
var label = t("sectionCode");
|
||||||
|
@ -915,13 +920,14 @@ function renderLintReport(blockChanged) {
|
||||||
var html = "<caption>" + label + " " + (index+1) + "</caption>" + cm.state.lint.html;
|
var html = "<caption>" + label + " " + (index+1) + "</caption>" + cm.state.lint.html;
|
||||||
newBlock.innerHTML = html;
|
newBlock.innerHTML = html;
|
||||||
newBlock.cm = cm;
|
newBlock.cm = cm;
|
||||||
if (!blockChanged) {
|
|
||||||
var block = content.children[newContent.children.length - 1];
|
var block = content.children[newContent.children.length - 1];
|
||||||
blockChanged = !block || cm != block.cm || html != block.innerHTML;
|
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.replaceChild(newContent, content);
|
||||||
container.style.display = newContent.children.length ? "block" : "none";
|
container.style.display = newContent.children.length ? "block" : "none";
|
||||||
resizeLintReport(null, newContent);
|
resizeLintReport(null, newContent);
|
||||||
|
|
|
@ -43,6 +43,12 @@
|
||||||
width: 100%; height: 2px;
|
width: 100%; height: 2px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
img[src*="world"] {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
vertical-align: middle;
|
||||||
|
image-rendering: -webkit-optimize-contrast;
|
||||||
|
}
|
||||||
.applies-to {
|
.applies-to {
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
BIN
world_go.png
BIN
world_go.png
Binary file not shown.
Before Width: | Height: | Size: 793 B After Width: | Height: | Size: 2.5 KiB |
Loading…
Reference in New Issue
Block a user