mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 08:57:58 +01:00
Deal with echoed messages being cleared by scroll event. Closes issue #374.
This commit is contained in:
@@ -150,7 +150,7 @@ var Buffer = Module("buffer", {
|
|||||||
// called when the active document is scrolled
|
// called when the active document is scrolled
|
||||||
_updateBufferPosition: function _updateBufferPosition() {
|
_updateBufferPosition: function _updateBufferPosition() {
|
||||||
statusline.updateBufferPosition();
|
statusline.updateBufferPosition();
|
||||||
commandline.clear();
|
commandline.clear(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -619,8 +619,10 @@ var CommandLine = Module("commandline", {
|
|||||||
return commands.lastCommand = val;
|
return commands.lastCommand = val;
|
||||||
},
|
},
|
||||||
|
|
||||||
clear: function clear() {
|
clear: function clear(scroll) {
|
||||||
this.clearMessage();
|
if (!scroll || Date.now() - this._lastEchoTime > 5000)
|
||||||
|
this.clearMessage();
|
||||||
|
this._lastEchoTime = 0;
|
||||||
|
|
||||||
if (!this.commandSession) {
|
if (!this.commandSession) {
|
||||||
this.widgets.command = null;
|
this.widgets.command = null;
|
||||||
@@ -754,10 +756,12 @@ var CommandLine = Module("commandline", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._lastClearable = action === this._echoLine && String(data);
|
this._lastClearable = action === this._echoLine && String(data);
|
||||||
|
this._lastEchoTime = (flags & this.FORCE_SINGLELINE) && Date.now();
|
||||||
|
|
||||||
if (action)
|
if (action)
|
||||||
action.call(this, data, highlightGroup, single);
|
action.call(this, data, highlightGroup, single);
|
||||||
},
|
},
|
||||||
|
_lastEchoTime: 0,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prompt the user. Sets modes.main to COMMAND_LINE, which the user may
|
* Prompt the user. Sets modes.main to COMMAND_LINE, which the user may
|
||||||
|
|||||||
@@ -93,10 +93,8 @@ var RangeFinder = Module("rangefinder", {
|
|||||||
find: function (pattern, backwards) {
|
find: function (pattern, backwards) {
|
||||||
let str = this.bootstrap(pattern, backwards);
|
let str = this.bootstrap(pattern, backwards);
|
||||||
if (!this.rangeFind.find(str))
|
if (!this.rangeFind.find(str))
|
||||||
this.timeout(function () {
|
this.dactyl.echoerr("E486: Pattern not found: " + pattern,
|
||||||
this.dactyl.echoerr("E486: Pattern not found: " + pattern,
|
this.commandline.FORCE_SINGLELINE);
|
||||||
this.commandline.FORCE_SINGLELINE);
|
|
||||||
});
|
|
||||||
|
|
||||||
return this.rangeFind.found;
|
return this.rangeFind.found;
|
||||||
},
|
},
|
||||||
@@ -107,15 +105,12 @@ var RangeFinder = Module("rangefinder", {
|
|||||||
else if (!this.rangeFind.find(null, reverse))
|
else if (!this.rangeFind.find(null, reverse))
|
||||||
this.dactyl.echoerr("E486: Pattern not found: " + this.lastFindPattern,
|
this.dactyl.echoerr("E486: Pattern not found: " + this.lastFindPattern,
|
||||||
this.commandline.FORCE_SINGLELINE);
|
this.commandline.FORCE_SINGLELINE);
|
||||||
else if (this.rangeFind.wrapped)
|
else if (this.rangeFind.wrapped) {
|
||||||
// hack needed, because wrapping causes a "scroll" event which
|
let msg = this.rangeFind.backward ? "find hit TOP, continuing at BOTTOM"
|
||||||
// clears our command line
|
: "find hit BOTTOM, continuing at TOP";
|
||||||
this.timeout(function () {
|
this.commandline.echo(msg, "WarningMsg", this.commandline.APPEND_TO_MESSAGES
|
||||||
let msg = this.rangeFind.backward ? "find hit TOP, continuing at BOTTOM"
|
| this.commandline.FORCE_SINGLELINE);
|
||||||
: "find hit BOTTOM, continuing at TOP";
|
}
|
||||||
this.commandline.echo(msg, "WarningMsg", this.commandline.APPEND_TO_MESSAGES
|
|
||||||
| this.commandline.FORCE_SINGLELINE);
|
|
||||||
}, 0);
|
|
||||||
else
|
else
|
||||||
this.commandline.echo((this.rangeFind.backward ? "?" : "/") + this.lastFindPattern,
|
this.commandline.echo((this.rangeFind.backward ? "?" : "/") + this.lastFindPattern,
|
||||||
"Normal", this.commandline.FORCE_SINGLELINE);
|
"Normal", this.commandline.FORCE_SINGLELINE);
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ var Option = Class("Option", {
|
|||||||
if (this.type in Option.stringify)
|
if (this.type in Option.stringify)
|
||||||
this.stringify = Option.stringify[this.type];
|
this.stringify = Option.stringify[this.type];
|
||||||
|
|
||||||
|
if (this.type in Option.domains)
|
||||||
|
this.domains = Option.domains[this.type];
|
||||||
|
|
||||||
if (this.type in Option.testValues)
|
if (this.type in Option.testValues)
|
||||||
this.testValues = Option.testValues[this.type];
|
this.testValues = Option.testValues[this.type];
|
||||||
|
|
||||||
@@ -331,7 +334,7 @@ var Option = Class("Option", {
|
|||||||
* references to a given domain from the given values.
|
* references to a given domain from the given values.
|
||||||
*/
|
*/
|
||||||
filterDomain: function filterDomain(host, values)
|
filterDomain: function filterDomain(host, values)
|
||||||
Array.filter(values, function (val) !util.isSubdomain(val, host)),
|
Array.filter(values, function (val) !this.domains([val]).some(function (val) util.isSubdomain(val, host)), this),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {value} The option's default value. This value will be used
|
* @property {value} The option's default value. This value will be used
|
||||||
@@ -471,6 +474,11 @@ var Option = Class("Option", {
|
|||||||
get sitemap() this.regexplist
|
get sitemap() this.regexplist
|
||||||
},
|
},
|
||||||
|
|
||||||
|
domains: {
|
||||||
|
sitelist: function (vals) array.compact(vals.map(function (site) util.getHost(site.filter))),
|
||||||
|
get sitemap() this.sitelist
|
||||||
|
},
|
||||||
|
|
||||||
stringify: {
|
stringify: {
|
||||||
charlist: function (vals) Commands.quote(vals.join("")),
|
charlist: function (vals) Commands.quote(vals.join("")),
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user