mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 18:47:58 +01:00
Also linkify 'Last set from' in :set output.
This commit is contained in:
@@ -561,7 +561,7 @@ const Commands = Module("commands", {
|
|||||||
sourcing = sourcing || { file: "[Command Line]", line: 1 };
|
sourcing = sourcing || { file: "[Command Line]", line: 1 };
|
||||||
this.sourcing = update({}, sourcing);
|
this.sourcing = update({}, sourcing);
|
||||||
|
|
||||||
args = update({ setFrom: this.sourcing.file }, args || {});
|
args = update({}, args || {});
|
||||||
|
|
||||||
if (tokens)
|
if (tokens)
|
||||||
string = commands.replaceTokens(string, tokens);
|
string = commands.replaceTokens(string, tokens);
|
||||||
|
|||||||
@@ -892,13 +892,15 @@ const Options = Module("options", {
|
|||||||
if (opt.all)
|
if (opt.all)
|
||||||
options.list(opt.onlyNonDefault, opt.scope);
|
options.list(opt.onlyNonDefault, opt.scope);
|
||||||
else {
|
else {
|
||||||
|
XML.prettyPrinting = false;
|
||||||
|
XML.ignoreWhitespace = false;
|
||||||
if (option.type == "boolean")
|
if (option.type == "boolean")
|
||||||
var msg = (opt.optionValue ? " " : "no") + option.name;
|
var msg = (opt.optionValue ? " " : "no") + option.name;
|
||||||
else
|
else
|
||||||
msg = " " + option.name + "=" + opt.option.stringify(opt.optionValue);
|
msg = " " + option.name + "=" + opt.option.stringify(opt.optionValue);
|
||||||
|
|
||||||
if (options["verbose"] > 0 && option.setFrom)
|
if (options["verbose"] > 0 && option.setFrom)
|
||||||
msg += "\n Last set from " + option.setFrom;
|
msg = <>{msg}<br/> Last set from {template.sourceLink(option.setFrom)}</>;
|
||||||
|
|
||||||
dactyl.echo(<span highlight="CmdOutput Message">{msg}</span>);
|
dactyl.echo(<span highlight="CmdOutput Message">{msg}</span>);
|
||||||
}
|
}
|
||||||
@@ -918,7 +920,7 @@ const Options = Module("options", {
|
|||||||
}
|
}
|
||||||
if (res)
|
if (res)
|
||||||
dactyl.echoerr(res);
|
dactyl.echoerr(res);
|
||||||
option.setFrom = modifiers.setFrom || null;
|
option.setFrom = commands.getCaller(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,6 +244,24 @@ const Template = Module("Template", {
|
|||||||
// </e4x>
|
// </e4x>
|
||||||
},
|
},
|
||||||
|
|
||||||
|
sourceLink: function (frame) {
|
||||||
|
let url = (frame.filename || "unknown").replace(/.* -> /, "");
|
||||||
|
function getPath(url) {
|
||||||
|
try {
|
||||||
|
return util.getFile(util.newURI(url)).path;
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return <a xmlns:dactyl={NS} dactyl:command="buffer.viewSource"
|
||||||
|
href={url} line={frame.lineNumber}
|
||||||
|
highlight="URL">{
|
||||||
|
getPath(url) + ":" + frame.lineNumber
|
||||||
|
}</a>
|
||||||
|
},
|
||||||
|
|
||||||
table: function table(title, data, indent) {
|
table: function table(title, data, indent) {
|
||||||
let table =
|
let table =
|
||||||
// <e4x>
|
// <e4x>
|
||||||
@@ -289,14 +307,6 @@ const Template = Module("Template", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
usage: function usage(iter) {
|
usage: function usage(iter) {
|
||||||
function getPath(url) {
|
|
||||||
try {
|
|
||||||
return util.getFile(util.newURI(url)).path;
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// <e4x>
|
// <e4x>
|
||||||
return <table>
|
return <table>
|
||||||
{
|
{
|
||||||
@@ -304,14 +314,9 @@ const Template = Module("Template", {
|
|||||||
<tr>
|
<tr>
|
||||||
<td style="padding-right: 20px" highlight="Usage">{
|
<td style="padding-right: 20px" highlight="Usage">{
|
||||||
let (name = item.name || item.names[0], frame = item.definedAt)
|
let (name = item.name || item.names[0], frame = item.definedAt)
|
||||||
!frame ? name : /* Help... --Kris */
|
!frame ? name : <>
|
||||||
let (url = (frame.filename || "unknown").replace(/.* -> /, ""))
|
<span highlight="Title">{name}</span> 
|
||||||
<><span highlight="Title">{name}</span> 
|
<span highlight="LineInfo">Defined at {template.sourceLink(frame)}</span>
|
||||||
<span highlight="LineInfo">
|
|
||||||
Defined at <a xmlns:dactyl={NS} dactyl:command="buffer.viewSource"
|
|
||||||
href={url} line={frame.lineNumber}
|
|
||||||
highlight="URL">{ getPath(url) + ":" + frame.lineNumber }</a>
|
|
||||||
</span>
|
|
||||||
</>
|
</>
|
||||||
}</td>
|
}</td>
|
||||||
<td>{item.description}</td>
|
<td>{item.description}</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user