mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-09 19:04:12 +01:00
Also linkify 'Last set from' in :set output.
This commit is contained in:
@@ -244,6 +244,24 @@ const Template = Module("Template", {
|
||||
// </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) {
|
||||
let table =
|
||||
// <e4x>
|
||||
@@ -289,14 +307,6 @@ const Template = Module("Template", {
|
||||
},
|
||||
|
||||
usage: function usage(iter) {
|
||||
function getPath(url) {
|
||||
try {
|
||||
return util.getFile(util.newURI(url)).path;
|
||||
}
|
||||
catch (e) {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
// <e4x>
|
||||
return <table>
|
||||
{
|
||||
@@ -304,15 +314,10 @@ const Template = Module("Template", {
|
||||
<tr>
|
||||
<td style="padding-right: 20px" highlight="Usage">{
|
||||
let (name = item.name || item.names[0], frame = item.definedAt)
|
||||
!frame ? name : /* Help... --Kris */
|
||||
let (url = (frame.filename || "unknown").replace(/.* -> /, ""))
|
||||
<><span highlight="Title">{name}</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>
|
||||
</>
|
||||
!frame ? name : <>
|
||||
<span highlight="Title">{name}</span> 
|
||||
<span highlight="LineInfo">Defined at {template.sourceLink(frame)}</span>
|
||||
</>
|
||||
}</td>
|
||||
<td>{item.description}</td>
|
||||
</tr>)
|
||||
|
||||
Reference in New Issue
Block a user