From 67ccf61f0bdfa57bbe4a1d70cab8f4920ce81237 Mon Sep 17 00:00:00 2001 From: Dave Hoover Date: Wed, 8 Jun 2016 16:52:17 -0500 Subject: [PATCH] Fixing #53 and #71 by reverting 0a37e6a --- src/app.js | 8 ++++---- src/app/editor.js | 4 ++-- src/app/renderer.js | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/app.js b/src/app.js index 79d010ec04..89fd2f14a6 100644 --- a/src/app.js +++ b/src/app.js @@ -32,7 +32,7 @@ var run = function () { } window.localStorage[key] = content; } - editor.setCacheFile(Object.keys(files)[0]); + editor.setCacheFile(utils.fileKey(Object.keys(files)[0])); updateFiles(); } @@ -198,7 +198,7 @@ var run = function () { var content = window.localStorage.getItem(utils.fileKey(originalName)); window.localStorage[utils.fileKey(newName)] = content; window.localStorage.removeItem(utils.fileKey(originalName)); - editor.setCacheFile(newName); + editor.setCacheFile(utils.fileKey(newName)); } updateFiles(); @@ -222,13 +222,13 @@ var run = function () { function showFileHandler (ev) { ev.preventDefault(); - editor.setCacheFile($(this).find('.name').text()); + editor.setCacheFile(utils.fileKey($(this).find('.name').text())); updateFiles(); return false; } function activeFileTab () { - var name = editor.getCacheFile(); + var name = utils.fileNameFromKey(editor.getCacheFile()); return $('#files .file').filter(function () { return $(this).find('.name').text() === name; }); } diff --git a/src/app/editor.js b/src/app/editor.js index 4592525d75..0c25d0b828 100644 --- a/src/app/editor.js +++ b/src/app/editor.js @@ -32,11 +32,11 @@ function Editor (loadingFromGist) { }; this.setCacheFile = function (cacheFile) { - SOL_CACHE_FILE = utils.fileKey(cacheFile); + SOL_CACHE_FILE = cacheFile; }; this.getCacheFile = function () { - return utils.fileNameFromKey(SOL_CACHE_FILE); + return SOL_CACHE_FILE; }; this.cacheFileIsPresent = function () { diff --git a/src/app/renderer.js b/src/app/renderer.js index b852390b51..811ec9b44d 100644 --- a/src/app/renderer.js +++ b/src/app/renderer.js @@ -19,7 +19,7 @@ function Renderer (editor, compiler, updateFiles) { var errFile = err[1]; var errLine = parseInt(err[2], 10) - 1; var errCol = err[4] ? parseInt(err[4], 10) : 0; - if (errFile === '' || errFile === editor.getCacheFile()) { + if (errFile === '' || errFile === utils.fileNameFromKey(editor.getCacheFile())) { compiler.addAnnotation({ row: errLine, column: errCol, @@ -28,9 +28,9 @@ function Renderer (editor, compiler, updateFiles) { }); } $error.click(function (ev) { - if (errFile !== '' && errFile !== editor.getCacheFile() && editor.hasFile(errFile)) { + if (errFile !== '' && errFile !== utils.fileNameFromKey(editor.getCacheFile()) && editor.hasFile(errFile)) { // Switch to file - editor.setCacheFile(errFile); + editor.setCacheFile(utils.fileKey(errFile)); updateFiles(); // @TODO could show some error icon in files with errors }