1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-04 00:54:14 +01:00

Do something sensible for items defined from :map/:com/... in :*usage!.

This commit is contained in:
Kris Maglione
2010-12-09 22:25:20 -05:00
parent 4c9e73949c
commit 75342f09ec
4 changed files with 29 additions and 8 deletions

View File

@@ -289,6 +289,14 @@ 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>
{
@@ -297,15 +305,12 @@ const Template = Module("Template", {
<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.replace(/.* -> /, ""))
let (url = (frame.filename || "unknown").replace(/.* -> /, ""))
<><span highlight="Title">{name}</span>&#xa0;
<span highlight="LineInfo">
Defined at&#xa0;<a xmlns:dactyl={NS} dactyl:command="buffer.viewSource"
href={url} line={frame.lineNumber}
highlight="URL">{
(util.getFile(util.newURI(url)) || { path: url }).path
+ ":" + frame.lineNumber
}</a>
highlight="URL">{ getPath(url) + ":" + frame.lineNumber }</a>
</span>
</>
}</td>