1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-28 19:55:45 +01:00

Fix a race.

--HG--
branch : groups
This commit is contained in:
Kris Maglione
2011-02-10 16:23:38 -05:00
parent 60063a8f91
commit 89020be0ee
4 changed files with 30 additions and 22 deletions

View File

@@ -36,6 +36,8 @@ var Editor = Module("editor", {
let text = dactyl.clipboardRead(clipboard);
if (!text)
return;
if (isinstance(elem, [HTMLInputElement, XULTextBoxElement]))
text = text.replace(/\n+/g, "");
// This is a hacky fix - but it works.
// <s-insert> in the bottom of a long textarea bounces up
@@ -46,7 +48,9 @@ var Editor = Module("editor", {
let end = elem.selectionEnd;
let value = elem.value.substring(0, start) + text + elem.value.substring(end);
elem.value = value;
Editor.getEditor(elem).rootElement.firstChild.textContent = value;
elem.selectionStart = Math.min(start + (toStart ? 0 : text.length), elem.value.length);
elem.selectionEnd = elem.selectionStart;

View File

@@ -245,6 +245,8 @@ var Modes = Module("modes", {
getCharModes: function (chr) (this.modeChars[chr] || []).slice(),
have: function have(mode) this._modeStack.some(function (m) isinstance(m.main, mode)),
matchModes: function (obj)
this._modes.filter(function (mode) Object.keys(obj)
.every(function (k) obj[k] == (mode[k] || false))),
@@ -397,7 +399,7 @@ var Modes = Module("modes", {
},
isinstance: function (obj)
this.allBases.indexOf(obj) >= 0 || callable(obj) && this instanceof obj,
this === obj || this.allBases.indexOf(obj) >= 0 || callable(obj) && this instanceof obj,
allBases: Class.memoize(function () {
let seen = {}, res = [], queue = this.bases;

View File

@@ -10,25 +10,28 @@ var MOW = Module("mow", {
init: function () {
this._resize = Timer(20, 400, function () {
if (this.visible) {
if (this.visible)
this.resize(false);
if (this.visible && isinstance(modes.main, modes.OUTPUT_MULTILINE))
this.updateMorePrompt();
}
}, this);
this._timer = Timer(20, 400, function () {
this.resize(true);
if (modes.have(modes.OUTPUT_MULTILINE)) {
this.resize(true);
if (options["more"] && this.isScrollable(1)) {
// start the last executed command's output at the top of the screen
let elements = this.document.getElementsByClassName("ex-command-output");
elements[elements.length - 1].scrollIntoView(true);
if (options["more"] && this.isScrollable(1)) {
// start the last executed command's output at the top of the screen
let elements = this.document.getElementsByClassName("ex-command-output");
elements[elements.length - 1].scrollIntoView(true);
}
else
this.body.scrollTop = this.body.scrollHeight;
dactyl.focus(this.window);
this.updateMorePrompt();
}
else
this.body.scrollTop = this.body.scrollHeight;
dactyl.focus(this.window);
this.updateMorePrompt();
}, this);
events.listen(window, this, "windowEvents");