1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 23:37:58 +01:00

put the help section locating block in a timeout to sure the first call to

:help {arg} works
This commit is contained in:
Doug Kearns
2007-10-11 01:26:40 +00:00
parent 5a83a74199
commit 4360662aa2

View File

@@ -59,9 +59,7 @@ vimperator.help = function(section, easter) //{{{
// keep <br/> // keep <br/>
//usage = usage.replace(/<([^b][^r].*>)/g, "&lt;$1"); //usage = usage.replace(/<([^b][^r].*>)/g, "&lt;$1");
//usage = usage.replace(/[^b][^r][^\/]>/g, "&gt;"); //usage = usage.replace(/[^b][^r][^\/]>/g, "&gt;");
usage = usage.replace(/&/g, "&amp;"); usage = vimperator.util.escapeHTML(usage);
usage = usage.replace(/</g, "&lt;");
usage = usage.replace(/>/g, "&gt;");
usage = usage.replace(/\\n/g, "<br/>"); usage = usage.replace(/\\n/g, "<br/>");
// color [count], [!], {arg} and [arg] in the usage, not nice and error prone but the regexp work (for now) // color [count], [!], {arg} and [arg] in the usage, not nice and error prone but the regexp work (for now)
usage = usage.replace(/({[^}]+})/g, "<span class=\"argument\">$1</span>"); // required args usage = usage.replace(/({[^}]+})/g, "<span class=\"argument\">$1</span>"); // required args
@@ -98,11 +96,7 @@ vimperator.help = function(section, easter) //{{{
for (var j=0; j < names.length; j++) for (var j=0; j < names.length; j++)
{ {
var cmd_name = names[j]; var cmd_name = names[j];
cmd_name = cmd_name.replace(/</g, "&lt;"); cmd_name = vimperator.util.escapeHTML(cmd_name);
cmd_name = cmd_name.replace(/>/g, "&gt;");
// cmd_name = cmd_name.replace(/"/g, "&quot;");
// cmd_name = cmd_name.replace(/'/g, "&apos;");
// cmd_name = cmd_name.replace(/&/g, "&amp;");
ret += '<code class="tag">' + beg + cmd_name + end + '</code><br/>'; ret += '<code class="tag">' + beg + cmd_name + end + '</code><br/>';
} }
ret += '</td></tr>'; ret += '</td></tr>';
@@ -228,6 +222,7 @@ vimperator.help = function(section, easter) //{{{
} }
catch(e) catch(e)
{ {
// FIXME: what's this all about then, eh? Works the same for if it's removed. -- djk
// when the url is "about:" or any other xhtml page the doc is not open // when the url is "about:" or any other xhtml page the doc is not open
// then retry again in 250ms but just once // then retry again in 250ms but just once
if (arguments[3] && arguments[3].recursive) if (arguments[3] && arguments[3].recursive)
@@ -259,6 +254,8 @@ vimperator.help = function(section, easter) //{{{
return [valueL, valueT]; return [valueL, valueT];
} }
// FIXME
setTimeout(function() {
if (section) if (section)
{ {
function findSectionElement(section) function findSectionElement(section)
@@ -288,6 +285,7 @@ vimperator.help = function(section, easter) //{{{
// horizontal offset is annoying, set it to 0 (use pos[0] if you want horizontal offset) // horizontal offset is annoying, set it to 0 (use pos[0] if you want horizontal offset)
window.content.scrollTo(0, pos[1]); window.content.scrollTo(0, pos[1]);
} }
}, 0);
} //}}} } //}}}
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et: