1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 18:42:27 +01:00

Deal with fallout from 609832.

This commit is contained in:
Kris Maglione
2011-01-09 16:15:52 -05:00
parent 415386a183
commit 04f55e9324
10 changed files with 148 additions and 151 deletions

View File

@@ -307,6 +307,21 @@ var Editor = Module("editor", {
}
});
function update(force) {
if (force !== true && tmpfile.lastModifiedTime <= lastUpdate)
return;
lastUpdate = Date.now();
let val = tmpfile.read();
if (textBox)
textBox.value = val;
else {
while (editor.rootElement.firstChild)
editor.rootElement.removeChild(editor.rootElement.firstChild);
editor.rootElement.innerHTML = val;
}
}
try {
var tmpfile = io.createTempFile();
if (!tmpfile)
@@ -322,20 +337,6 @@ var Editor = Module("editor", {
"file encoding");
let lastUpdate = Date.now();
function update(force) {
if (force !== true && tmpfile.lastModifiedTime <= lastUpdate)
return;
lastUpdate = Date.now();
let val = tmpfile.read();
if (textBox)
textBox.value = val;
else {
while (editor.rootElement.firstChild)
editor.rootElement.removeChild(editor.rootElement.firstChild);
editor.rootElement.innerHTML = val;
}
}
var timer = services.Timer(update, 100, services.Timer.TYPE_REPEATING_SLACK);
this.editFileExternally({ file: tmpfile.path, line: line, column: column }, cleanup);