From 5d52a7ec2ef220de87c8994416b643ef85d3241a Mon Sep 17 00:00:00 2001 From: tophf Date: Tue, 1 Sep 2015 10:54:56 +0300 Subject: [PATCH 1/3] Editor: "findNext" after page load should call "find" --- edit.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/edit.js b/edit.js index 56e93243..6726ca8b 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 = { From 485932ae4902e518daf009d517214366fbc82ad4 Mon Sep 17 00:00:00 2001 From: tophf Date: Tue, 1 Sep 2015 21:47:40 +0300 Subject: [PATCH 2/3] Update world_go.png to 32x32, also suitable for retina --- edit.html | 6 ++++++ manage.html | 6 ++++++ world_go.png | Bin 793 -> 2525 bytes 3 files changed, 12 insertions(+) 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/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 f738522f5d449637c132546df6994c1c24f0c5bf..da1c77019148124a623addf86b572b4ad7f83166 100644 GIT binary patch literal 2525 zcmV<32_p81P)zkC1t zI6U2@>hR9~w?s}iPJ}j3k~tdUz$sHQR4PC%3rE#5zu&$x{|_`MJ>|NgHJ*HF;+K9= zuGU6O9+h<+d0n08pV5eDy^CQY*TKI{o+wn_=zxl=796cMLlRs&>sO4LPSb(!3xKoy zvV5FR7rpnTVGg{QdjS@05=2=KzvPBnya%Un1v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0Ps;_HhXZi zmrUjK0y`cAzm_>aD=+j?#@2S}n4biu@ld!gS8~;SI-RdyPXQ&?N-wXDad{$hH&-kU zl=#$scHWy6ojbJeSR5F(_Ev4mGRIv=`=MJ5JT0xQJF@FalEn+B6X2b0bUFs-TBfS1 zN)ZJJSgrb(E%7{WDgsFZ&@(3cYllJ~MMWTop^u)Q`~K;6KOY5h2nK?)7>;8oN&vtg XV%ICrMR!y300000NkvXXu0mjf=ze~_ From a7deb149310ea6f0f0dd30685373e3e0630b218c Mon Sep 17 00:00:00 2001 From: tophf Date: Sun, 13 Sep 2015 12:41:19 +0300 Subject: [PATCH 3/3] Editor: don't spam in lint report for current line --- edit.js | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/edit.js b/edit.js index 6726ca8b..ef3f9228 100644 --- a/edit.js +++ b/edit.js @@ -851,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 + "" + @@ -883,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() { @@ -907,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"); @@ -918,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);