mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-22 03:05:45 +01:00
:marks support
This commit is contained in:
@@ -526,6 +526,30 @@ function Marks() //{{{
|
|||||||
// TODO: show marks like vim does (when the multiline echo impl is done) or in the preview window right now
|
// TODO: show marks like vim does (when the multiline echo impl is done) or in the preview window right now
|
||||||
this.list = function()
|
this.list = function()
|
||||||
{
|
{
|
||||||
|
// FIXME: hashes don't have a .length property --mst
|
||||||
|
// if (local_marks.length + url_marks.length < 1)
|
||||||
|
// {
|
||||||
|
// vimperator.echoerr("No marks defined");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
var list = "<table><tr style=\"color: magenta\"><td>mark</td><td>line</td><td>col</td><td>file</td></tr>";
|
||||||
|
for (var i in local_marks)
|
||||||
|
{
|
||||||
|
list += "<tr><td align=\"right\">" + i + "</td><td align=\"right\">"
|
||||||
|
+ Math.round(local_marks[i][0].position.y *100)+ "%</td><td align=\"right\">"
|
||||||
|
+ Math.round(local_marks[i][0].position.x *100)+ "%</td><td>"
|
||||||
|
+ local_marks[i][0].location + "</td></tr>";
|
||||||
|
}
|
||||||
|
for (var j in url_marks)
|
||||||
|
{
|
||||||
|
list += "<tr><td align=\"right\">" + j + "</td><td align=\"right\">"
|
||||||
|
+ Math.round(url_marks[j].position.y *100)+ "%</td><td align=\"right\">"
|
||||||
|
+ Math.round(url_marks[j].position.x *100)+ "%</td><td>"
|
||||||
|
+ url_marks[j].location + "</td></tr>";
|
||||||
|
}
|
||||||
|
list += "</table>";
|
||||||
|
vimperator.commandline.echo(list, true); // TODO: force of multiline widget a better way
|
||||||
}
|
}
|
||||||
//}}}
|
//}}}
|
||||||
} //}}}
|
} //}}}
|
||||||
|
|||||||
@@ -133,20 +133,14 @@ function CommandLine() //{{{
|
|||||||
// Sets the command - e.g. 'tabopen', 'open http://example.com/'
|
// Sets the command - e.g. 'tabopen', 'open http://example.com/'
|
||||||
function setCommand(cmd)
|
function setCommand(cmd)
|
||||||
{
|
{
|
||||||
// FIXME: very simple, buggy version as of yet, just a tech-demo --mst
|
command_widget.value = cmd;
|
||||||
//multiline_widget.contentDocument.designMode ="on";
|
}
|
||||||
// multiline
|
|
||||||
if (cmd.indexOf("\n") > -1 || cmd.indexOf("\\n") > -1 || cmd.indexOf("<br>") > -1 || cmd.indexOf("<br/>") > -1)
|
function setMultiline(cmd)
|
||||||
{
|
{
|
||||||
multiline_widget.collapsed = false;
|
multiline_widget.collapsed = false;
|
||||||
cmd = cmd.replace(/\n|\\n/g, "<br/>") + "<br/><span style=\"color: green;\">Press ENTER or type command to continue</span>";
|
cmd = cmd.replace(/\n|\\n/g, "<br/>") + "<br/><span style=\"color: green;\">Press ENTER or type command to continue</span>";
|
||||||
multiline_widget.contentDocument.body.innerHTML = cmd;
|
multiline_widget.contentDocument.body.innerHTML = cmd;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
multiline_widget.collapsed = true;
|
|
||||||
command_widget.value = cmd;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addToHistory(str)
|
function addToHistory(str)
|
||||||
@@ -193,15 +187,24 @@ function CommandLine() //{{{
|
|||||||
command_widget.focus();
|
command_widget.focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.echo = function(str)
|
// FIXME: flags not yet really functional --mst
|
||||||
|
this.echo = function(str, flags)
|
||||||
{
|
{
|
||||||
var focused = document.commandDispatcher.focusedElement;
|
var focused = document.commandDispatcher.focusedElement;
|
||||||
if (!echo_allowed && focused && focused == command_widget.inputField)
|
if (!echo_allowed && focused && focused == command_widget.inputField)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
setNormalStyle();
|
setNormalStyle();
|
||||||
setPrompt("");
|
if (flags || str.indexOf("\n") > -1 || str.indexOf("\\n") > -1 || str.indexOf("<br>") > -1 || str.indexOf("<br/>") > -1)
|
||||||
setCommand(str);
|
{
|
||||||
|
setMultiline(str);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
multiline_widget.collapsed = true;
|
||||||
|
setPrompt("");
|
||||||
|
setCommand(str);
|
||||||
|
}
|
||||||
cur_extended_mode = null;
|
cur_extended_mode = null;
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user