mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 18:27:58 +01:00
fixed system() and other io methods
This commit is contained in:
5
TODO
5
TODO
@@ -18,8 +18,6 @@ FEATURES:
|
|||||||
8 add more autocommands (BrowserStart, TabClose, TabOpen, TabChanged, LocationChanged, any more?)
|
8 add more autocommands (BrowserStart, TabClose, TabOpen, TabChanged, LocationChanged, any more?)
|
||||||
8 ;?<hint> should show more information
|
8 ;?<hint> should show more information
|
||||||
8 there should be a listbox/combobox mode
|
8 there should be a listbox/combobox mode
|
||||||
8 y and Y should be changed to: Y, yy and yl=yank location, ys=yank selection,
|
|
||||||
yd=yank domain name, yt=yank title, yw=yank current word, yf=yank filename, (other things to yank?)
|
|
||||||
8 all search commands should start searching from the top of the visible viewport
|
8 all search commands should start searching from the top of the visible viewport
|
||||||
8 :bdelete full_url<cr> and :bdelete! filter<cr> should delete all tabs matching filter or full_url
|
8 :bdelete full_url<cr> and :bdelete! filter<cr> should delete all tabs matching filter or full_url
|
||||||
7 adaptive learning for tab-completions
|
7 adaptive learning for tab-completions
|
||||||
@@ -44,6 +42,8 @@ FEATURES:
|
|||||||
5 make a command to search within google search results
|
5 make a command to search within google search results
|
||||||
(http://gadelkareem.com/2007/01/28/using-google-ajax-api-as-an-array/)
|
(http://gadelkareem.com/2007/01/28/using-google-ajax-api-as-an-array/)
|
||||||
maybe impossible, needs a per-site key from google
|
maybe impossible, needs a per-site key from google
|
||||||
|
4 y and Y could maybe changed to, but probably not: Y, yy and yl=yank location, ys=yank selection,
|
||||||
|
yd=yank domain name, yt=yank title, yw=yank current word, yf=yank filename, (other things to yank?)
|
||||||
4 Add -nargs, -complete, etc. to :command
|
4 Add -nargs, -complete, etc. to :command
|
||||||
4 } { should jump to the next paragraph of the page (maybe impossible)
|
4 } { should jump to the next paragraph of the page (maybe impossible)
|
||||||
3 Splitting Windows with [:sp :vsp ctrl-w,s ctrl-w,v] and closing with [ctrl-w,q], moving with [ctrl-w,w or tab]
|
3 Splitting Windows with [:sp :vsp ctrl-w,s ctrl-w,v] and closing with [ctrl-w,q], moving with [ctrl-w,w or tab]
|
||||||
@@ -53,5 +53,4 @@ FEATURES:
|
|||||||
RANDOM IDEAS:
|
RANDOM IDEAS:
|
||||||
* numbered tabs
|
* numbered tabs
|
||||||
* hide scrollbars: (window.content.document.body.style.overflow = "hidden" has problems with the mouse wheel)
|
* hide scrollbars: (window.content.document.body.style.overflow = "hidden" has problems with the mouse wheel)
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
|
|||||||
@@ -150,16 +150,20 @@ vimperator.Buffer = function () //{{{
|
|||||||
setter: function (value) { window.fullScreen = value; },
|
setter: function (value) { window.fullScreen = value; },
|
||||||
getter: function () { return window.fullScreen; }
|
getter: function () { return window.fullScreen; }
|
||||||
});
|
});
|
||||||
|
|
||||||
vimperator.options.add(["nextpattern",],
|
vimperator.options.add(["nextpattern",],
|
||||||
"Patterns to use when guessing the 'next' page in a document sequence",
|
"Patterns to use when guessing the 'next' page in a document sequence",
|
||||||
"stringlist", "\\bnext,^>$,^(>>|»)$,^(>|»),(>|»)$");
|
"stringlist", "\\bnext,^>$,^(>>|»)$,^(>|»),(>|»)$");
|
||||||
|
|
||||||
vimperator.options.add(["previouspattern"],
|
vimperator.options.add(["previouspattern"],
|
||||||
"Patterns to use when guessing the 'previous' page in a document sequence",
|
"Patterns to use when guessing the 'previous' page in a document sequence",
|
||||||
"stringlist", "\\bprev|previous\\b,^<$,^(<<|«)$,^(<|«),(<|«)$");
|
"stringlist", "\\bprev|previous\\b,^<$,^(<<|«)$,^(<|«),(<|«)$");
|
||||||
|
|
||||||
vimperator.options.add(["pageinfo", "pa"], "Desired info on :pa[geinfo]", "charlist", "gfm",
|
vimperator.options.add(["pageinfo", "pa"], "Desired info on :pa[geinfo]", "charlist", "gfm",
|
||||||
{
|
{
|
||||||
validator: function (value) { return !(/[^gfm]/.test(value) || value.length > 3 || value.length < 1); }
|
validator: function (value) { return !(/[^gfm]/.test(value) || value.length > 3 || value.length < 1); }
|
||||||
});
|
});
|
||||||
|
|
||||||
vimperator.options.add(["scroll", "scr"],
|
vimperator.options.add(["scroll", "scr"],
|
||||||
"Number of lines to scroll with <C-u> and <C-d> commands",
|
"Number of lines to scroll with <C-u> and <C-d> commands",
|
||||||
"number", 0,
|
"number", 0,
|
||||||
@@ -167,6 +171,7 @@ vimperator.Buffer = function () //{{{
|
|||||||
validator: function (value) { return value >= 0; }
|
validator: function (value) { return value >= 0; }
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
vimperator.options.add(["showstatuslinks", "ssli"],
|
vimperator.options.add(["showstatuslinks", "ssli"],
|
||||||
"Show the destination of the link under the cursor in the status bar",
|
"Show the destination of the link under the cursor in the status bar",
|
||||||
"number", 1,
|
"number", 1,
|
||||||
@@ -185,6 +190,7 @@ vimperator.Buffer = function () //{{{
|
|||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
var modes = vimperator.config.browserModes || [vimperator.modes.NORMAL];
|
var modes = vimperator.config.browserModes || [vimperator.modes.NORMAL];
|
||||||
|
|
||||||
vimperator.mappings.add(modes, ["i", "<Insert>"],
|
vimperator.mappings.add(modes, ["i", "<Insert>"],
|
||||||
@@ -337,10 +343,10 @@ vimperator.Buffer = function () //{{{
|
|||||||
|
|
||||||
// yanking
|
// yanking
|
||||||
vimperator.mappings.add(modes, ["Y"],
|
vimperator.mappings.add(modes, ["Y"],
|
||||||
"Copy selected text",
|
"Copy selected text or current word",
|
||||||
function ()
|
function ()
|
||||||
{
|
{
|
||||||
var sel = window.content.document.getSelection();
|
var sel = vimperator.buffer.getCurrentWord();
|
||||||
if (sel)
|
if (sel)
|
||||||
vimperator.copyToClipboard(sel, true);
|
vimperator.copyToClipboard(sel, true);
|
||||||
else
|
else
|
||||||
@@ -706,54 +712,6 @@ vimperator.Buffer = function () //{{{
|
|||||||
return selection;
|
return selection;
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: move to tabs.js
|
|
||||||
list: function (fullmode)
|
|
||||||
{
|
|
||||||
if (fullmode)
|
|
||||||
{
|
|
||||||
// toggle the special buffer preview window
|
|
||||||
if (vimperator.bufferwindow.visible())
|
|
||||||
{
|
|
||||||
vimperator.bufferwindow.hide();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var items = vimperator.completion.buffer("")[1];
|
|
||||||
vimperator.bufferwindow.show(items);
|
|
||||||
vimperator.bufferwindow.selectItem(getBrowser().mTabContainer.selectedIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// TODO: move this to vimperator.buffers.get()
|
|
||||||
var items = vimperator.completion.buffer("")[1];
|
|
||||||
var number, indicator, title, url;
|
|
||||||
|
|
||||||
var list = ":" + vimperator.util.escapeHTML(vimperator.commandline.getCommand()) + "<br/>" + "<table>";
|
|
||||||
for (var i = 0; i < items.length; i++)
|
|
||||||
{
|
|
||||||
if (i == vimperator.tabs.index())
|
|
||||||
indicator = " <span style=\"color: blue\">%</span> ";
|
|
||||||
else if (i == vimperator.tabs.index(vimperator.tabs.alternate))
|
|
||||||
indicator = " <span style=\"color: blue\">#</span> ";
|
|
||||||
else
|
|
||||||
indicator = " ";
|
|
||||||
|
|
||||||
[number, title] = items[i][0].split(/:\s+/, 2);
|
|
||||||
url = items[i][1];
|
|
||||||
url = vimperator.util.escapeHTML(url);
|
|
||||||
title = vimperator.util.escapeHTML(title);
|
|
||||||
|
|
||||||
list += "<tr><td align=\"right\"> " + number + "</td><td>" + indicator +
|
|
||||||
"</td><td style=\"width: 250px; max-width: 500px; overflow: hidden;\">" + title +
|
|
||||||
"</td><td><a href=\"#\" class=\"hl-URL buffer-list\">" + url + "</a></td></tr>";
|
|
||||||
}
|
|
||||||
list += "</table>";
|
|
||||||
|
|
||||||
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
scrollBottom: function ()
|
scrollBottom: function ()
|
||||||
{
|
{
|
||||||
scrollToPercentiles(-1, 100);
|
scrollToPercentiles(-1, 100);
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ vimperator.Commands = function () //{{{
|
|||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
var exCommands = [];
|
var exCommands = [];
|
||||||
var lastRunCommand = ""; // updated whenever the users runs a command with :!
|
|
||||||
|
|
||||||
// in '-quoted strings, only ' and \ itself are escaped
|
// in '-quoted strings, only ' and \ itself are escaped
|
||||||
// in "-quoted strings, also ", \n and \t are translated
|
// in "-quoted strings, also ", \n and \t are translated
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ vimperator.Completion = function () //{{{
|
|||||||
substrings = [];
|
substrings = [];
|
||||||
var nodes = [
|
var nodes = [
|
||||||
["BrowserExit", "when firefox exits"],
|
["BrowserExit", "when firefox exits"],
|
||||||
["BrowserRestart", "when firefox restarts"],
|
["BrowserRestart", "when firefox restarts"],
|
||||||
["PageLoad", "when a page gets (re)loaded/opened"]
|
["PageLoad", "when a page gets (re)loaded/opened"]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ vimperator.IO = function () //{{{
|
|||||||
const WINDOWS = navigator.platform == "Win32";
|
const WINDOWS = navigator.platform == "Win32";
|
||||||
var cwd = null, oldcwd = null;
|
var cwd = null, oldcwd = null;
|
||||||
var extname = vimperator.config.name.toLowerCase(); // "vimperator" or "muttator"
|
var extname = vimperator.config.name.toLowerCase(); // "vimperator" or "muttator"
|
||||||
|
var lastRunCommand = ""; // updated whenever the users runs a command with :!
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// COMMANDS ////////////////////////////////////////////////
|
////////////////////// COMMANDS ////////////////////////////////////////////////
|
||||||
@@ -174,7 +175,7 @@ vimperator.IO = function () //{{{
|
|||||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
return {
|
var ioManager = {
|
||||||
|
|
||||||
MODE_RDONLY: 0x01,
|
MODE_RDONLY: 0x01,
|
||||||
MODE_WRONLY: 0x02,
|
MODE_WRONLY: 0x02,
|
||||||
@@ -240,7 +241,7 @@ vimperator.IO = function () //{{{
|
|||||||
if (!dirs[i])
|
if (!dirs[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var fullname = this.expandPath(dirs[i]);
|
var fullname = ioManager.expandPath(dirs[i]);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
file.initWithPath(fullname);
|
file.initWithPath(fullname);
|
||||||
@@ -269,8 +270,8 @@ vimperator.IO = function () //{{{
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newdir = this.expandPath(newdir);
|
newdir = ioManager.expandPath(newdir);
|
||||||
var file = this.getFile(newdir);
|
var file = ioManager.getFile(newdir);
|
||||||
if (!file.exists() || !file.isDirectory())
|
if (!file.exists() || !file.isDirectory())
|
||||||
{
|
{
|
||||||
vimperator.echoerr("E344: Can't find directory \"" + newdir + "\" in path");
|
vimperator.echoerr("E344: Can't find directory \"" + newdir + "\" in path");
|
||||||
@@ -278,7 +279,7 @@ vimperator.IO = function () //{{{
|
|||||||
}
|
}
|
||||||
[cwd, oldcwd] = [newdir, cwd];
|
[cwd, oldcwd] = [newdir, cwd];
|
||||||
}
|
}
|
||||||
return this.getCurrentDirectory();
|
return ioManager.getCurrentDirectory();
|
||||||
},
|
},
|
||||||
|
|
||||||
getSpecialDirectory: function (directory)
|
getSpecialDirectory: function (directory)
|
||||||
@@ -290,15 +291,15 @@ vimperator.IO = function () //{{{
|
|||||||
else
|
else
|
||||||
pluginDir = "~/." + vimperator.config.name.toLowerCase() + "/" + directory;
|
pluginDir = "~/." + vimperator.config.name.toLowerCase() + "/" + directory;
|
||||||
|
|
||||||
pluginDir = this.getFile(this.expandPath(pluginDir));
|
pluginDir = ioManager.getFile(ioManager.expandPath(pluginDir));
|
||||||
|
|
||||||
return pluginDir.exists() && pluginDir.isDirectory() ? pluginDir : null;
|
return pluginDir.exists() && pluginDir.isDirectory() ? pluginDir : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
getRCFile: function ()
|
getRCFile: function ()
|
||||||
{
|
{
|
||||||
var rcFile1 = this.getFile("~/." + vimperator.config.name.toLowerCase() + "rc");
|
var rcFile1 = ioManager.getFile("~/." + vimperator.config.name.toLowerCase() + "rc");
|
||||||
var rcFile2 = this.getFile("~/_" + vimperator.config.name.toLowerCase() + "rc");
|
var rcFile2 = ioManager.getFile("~/_" + vimperator.config.name.toLowerCase() + "rc");
|
||||||
|
|
||||||
if (WINDOWS)
|
if (WINDOWS)
|
||||||
[rcFile1, rcFile2] = [rcFile2, rcFile1]
|
[rcFile1, rcFile2] = [rcFile2, rcFile1]
|
||||||
@@ -321,9 +322,9 @@ vimperator.IO = function () //{{{
|
|||||||
createInstance(Components.interfaces.nsILocalFile);
|
createInstance(Components.interfaces.nsILocalFile);
|
||||||
|
|
||||||
// convert relative to absolute pathname
|
// convert relative to absolute pathname
|
||||||
path = this.expandPath(path);
|
path = ioManager.expandPath(path);
|
||||||
if (!/^(file:|[a-zA-Z]:|\/)/.test(path)) // starts not with either /, C: or file:
|
if (!/^(file:|[a-zA-Z]:|\/)/.test(path)) // starts not with either /, C: or file:
|
||||||
path = this.getCurrentDirectory() + (WINDOWS ? "\\" : "/") + path; // TODO: for now homedir, later relative to current dir?
|
path = ioManager.getCurrentDirectory() + (WINDOWS ? "\\" : "/") + path; // TODO: for now homedir, later relative to current dir?
|
||||||
else
|
else
|
||||||
path = path.replace(/^file:(\/\/)?/, "");
|
path = path.replace(/^file:(\/\/)?/, "");
|
||||||
|
|
||||||
@@ -359,7 +360,7 @@ vimperator.IO = function () //{{{
|
|||||||
readDirectory: function (file)
|
readDirectory: function (file)
|
||||||
{
|
{
|
||||||
if (typeof file == "string")
|
if (typeof file == "string")
|
||||||
file = this.getFile(file);
|
file = ioManager.getFile(file);
|
||||||
else if (!(file instanceof Components.interfaces.nsILocalFile))
|
else if (!(file instanceof Components.interfaces.nsILocalFile))
|
||||||
throw Components.results.NS_ERROR_INVALID_ARG; // FIXME: does not work as expected, just shows undefined: undefined
|
throw Components.results.NS_ERROR_INVALID_ARG; // FIXME: does not work as expected, just shows undefined: undefined
|
||||||
|
|
||||||
@@ -390,7 +391,7 @@ vimperator.IO = function () //{{{
|
|||||||
|
|
||||||
var charset = "UTF-8";
|
var charset = "UTF-8";
|
||||||
if (typeof file == "string")
|
if (typeof file == "string")
|
||||||
file = this.getFile(file);
|
file = ioManager.getFile(file);
|
||||||
else if (!(file instanceof Components.interfaces.nsILocalFile))
|
else if (!(file instanceof Components.interfaces.nsILocalFile))
|
||||||
throw Components.results.NS_ERROR_INVALID_ARG; // FIXME: does not work as expected, just shows undefined: undefined
|
throw Components.results.NS_ERROR_INVALID_ARG; // FIXME: does not work as expected, just shows undefined: undefined
|
||||||
|
|
||||||
@@ -421,14 +422,14 @@ vimperator.IO = function () //{{{
|
|||||||
|
|
||||||
var charset = "UTF-8"; // Can be any character encoding name that Mozilla supports
|
var charset = "UTF-8"; // Can be any character encoding name that Mozilla supports
|
||||||
if (typeof file == "string")
|
if (typeof file == "string")
|
||||||
file = this.getFile(file);
|
file = ioManager.getFile(file);
|
||||||
else if (!(file instanceof Components.interfaces.nsILocalFile))
|
else if (!(file instanceof Components.interfaces.nsILocalFile))
|
||||||
throw Components.results.NS_ERROR_INVALID_ARG; // FIXME: does not work as expected, just shows undefined: undefined
|
throw Components.results.NS_ERROR_INVALID_ARG; // FIXME: does not work as expected, just shows undefined: undefined
|
||||||
|
|
||||||
if (mode == ">>")
|
if (mode == ">>")
|
||||||
mode = this.MODE_WRONLY | this.MODE_CREATE | this.MODE_APPEND;
|
mode = ioManager.MODE_WRONLY | ioManager.MODE_CREATE | ioManager.MODE_APPEND;
|
||||||
else if (!mode || mode == ">")
|
else if (!mode || mode == ">")
|
||||||
mode = this.MODE_WRONLY | this.MODE_CREATE | this.MODE_TRUNCATE;
|
mode = ioManager.MODE_WRONLY | ioManager.MODE_CREATE | ioManager.MODE_TRUNCATE;
|
||||||
|
|
||||||
if (!perms)
|
if (!perms)
|
||||||
perms = 0644;
|
perms = 0644;
|
||||||
@@ -491,7 +492,7 @@ vimperator.IO = function () //{{{
|
|||||||
// TODO: add shell/shellcmdflag options to replace "sh" and "-c"
|
// TODO: add shell/shellcmdflag options to replace "sh" and "-c"
|
||||||
system: function (str, input)
|
system: function (str, input)
|
||||||
{
|
{
|
||||||
var fileout = this.createTempFile();
|
var fileout = ioManager.createTempFile();
|
||||||
if (!fileout)
|
if (!fileout)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
@@ -503,18 +504,18 @@ vimperator.IO = function () //{{{
|
|||||||
var filein = null;
|
var filein = null;
|
||||||
if (input)
|
if (input)
|
||||||
{
|
{
|
||||||
filein = this.createTempFile();
|
filein = ioManager.createTempFile();
|
||||||
this.writeFile(filein, input);
|
ioManager.writeFile(filein, input);
|
||||||
command += " < \"" + filein.path.replace('"', '\\"') + "\"";
|
command += " < \"" + filein.path.replace('"', '\\"') + "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
var res;
|
var res;
|
||||||
if (WINDOWS)
|
if (WINDOWS)
|
||||||
res = this.run("cmd.exe", ["/C", command], true);
|
res = ioManager.run("cmd.exe", ["/C", command], true);
|
||||||
else
|
else
|
||||||
res = this.run("sh", ["-c", command], true);
|
res = ioManager.run("sh", ["-c", command], true);
|
||||||
|
|
||||||
var output = this.readFile(fileout);
|
var output = ioManager.readFile(fileout);
|
||||||
fileout.remove(false);
|
fileout.remove(false);
|
||||||
if (filein)
|
if (filein)
|
||||||
filein.remove(false);
|
filein.remove(false);
|
||||||
@@ -532,14 +533,14 @@ vimperator.IO = function () //{{{
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var file = this.getFile(filename);
|
var file = ioManager.getFile(filename);
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
{
|
{
|
||||||
if (!silent)
|
if (!silent)
|
||||||
vimperator.echoerr("E484: Can't open file " + filename);
|
vimperator.echoerr("E484: Can't open file " + filename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var str = this.readFile(filename);
|
var str = ioManager.readFile(filename);
|
||||||
|
|
||||||
// handle pure javascript files specially
|
// handle pure javascript files specially
|
||||||
if (/\.js$/.test(filename))
|
if (/\.js$/.test(filename))
|
||||||
@@ -602,6 +603,7 @@ vimperator.IO = function () //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
return ioManager;
|
||||||
//}}}
|
//}}}
|
||||||
}; //}}}
|
}; //}}}
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ vimperator.Tabs = function () //{{{
|
|||||||
return value.split(",").every(function (item) { return /^(homepage|quickmark|tabopen|paste|)$/.test(item); });
|
return value.split(",").every(function (item) { return /^(homepage|quickmark|tabopen|paste|)$/.test(item); });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
vimperator.options.add(["popups", "pps"],
|
vimperator.options.add(["popups", "pps"],
|
||||||
"Where to show requested popup windows",
|
"Where to show requested popup windows",
|
||||||
"number", 1,
|
"number", 1,
|
||||||
@@ -102,6 +103,7 @@ vimperator.Tabs = function () //{{{
|
|||||||
},
|
},
|
||||||
validator: function (value) { return (value >= 0 && value <= 3); }
|
validator: function (value) { return (value >= 0 && value <= 3); }
|
||||||
});
|
});
|
||||||
|
|
||||||
vimperator.options.add(["showtabline", "stal"],
|
vimperator.options.add(["showtabline", "stal"],
|
||||||
"Control when to show the tab bar of opened web pages",
|
"Control when to show the tab bar of opened web pages",
|
||||||
"number", 2,
|
"number", 2,
|
||||||
@@ -140,7 +142,7 @@ vimperator.Tabs = function () //{{{
|
|||||||
|
|
||||||
vimperator.mappings.add([vimperator.modes.NORMAL], ["B"],
|
vimperator.mappings.add([vimperator.modes.NORMAL], ["B"],
|
||||||
"Show buffer list",
|
"Show buffer list",
|
||||||
function () { vimperator.buffer.list(false); });
|
function () { vimperator.tabs.list(false); });
|
||||||
|
|
||||||
vimperator.mappings.add([vimperator.modes.NORMAL], ["d"],
|
vimperator.mappings.add([vimperator.modes.NORMAL], ["d"],
|
||||||
"Delete current buffer",
|
"Delete current buffer",
|
||||||
@@ -235,7 +237,7 @@ vimperator.Tabs = function () //{{{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vimperator.buffer.list(special);
|
vimperator.tabs.list(special);
|
||||||
});
|
});
|
||||||
|
|
||||||
vimperator.commands.add(["quita[ll]", "qa[ll]"],
|
vimperator.commands.add(["quita[ll]", "qa[ll]"],
|
||||||
@@ -456,6 +458,53 @@ vimperator.Tabs = function () //{{{
|
|||||||
return getBrowser().mTabContainer.selectedItem;
|
return getBrowser().mTabContainer.selectedItem;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
list: function (fullmode)
|
||||||
|
{
|
||||||
|
if (fullmode)
|
||||||
|
{
|
||||||
|
// toggle the special buffer preview window
|
||||||
|
if (vimperator.bufferwindow.visible())
|
||||||
|
{
|
||||||
|
vimperator.bufferwindow.hide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var items = vimperator.completion.buffer("")[1];
|
||||||
|
vimperator.bufferwindow.show(items);
|
||||||
|
vimperator.bufferwindow.selectItem(getBrowser().mTabContainer.selectedIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// TODO: move this to vimperator.buffers.get()
|
||||||
|
var items = vimperator.completion.buffer("")[1];
|
||||||
|
var number, indicator, title, url;
|
||||||
|
|
||||||
|
var list = ":" + (vimperator.util.escapeHTML(vimperator.commandline.getCommand()) || "buffers") + "<br/>" + "<table>";
|
||||||
|
for (var i = 0; i < items.length; i++)
|
||||||
|
{
|
||||||
|
if (i == vimperator.tabs.index())
|
||||||
|
indicator = " <span style=\"color: blue\">%</span> ";
|
||||||
|
else if (i == vimperator.tabs.index(vimperator.tabs.alternate))
|
||||||
|
indicator = " <span style=\"color: blue\">#</span> ";
|
||||||
|
else
|
||||||
|
indicator = " ";
|
||||||
|
|
||||||
|
[number, title] = items[i][0].split(/:\s+/, 2);
|
||||||
|
url = items[i][1];
|
||||||
|
url = vimperator.util.escapeHTML(url);
|
||||||
|
title = vimperator.util.escapeHTML(title);
|
||||||
|
|
||||||
|
list += "<tr><td align=\"right\"> " + number + "</td><td>" + indicator +
|
||||||
|
"</td><td style=\"width: 250px; max-width: 500px; overflow: hidden;\">" + title +
|
||||||
|
"</td><td><a href=\"#\" class=\"hl-URL buffer-list\">" + url + "</a></td></tr>";
|
||||||
|
}
|
||||||
|
list += "</table>";
|
||||||
|
|
||||||
|
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// wrap causes the movement to wrap around the start and end of the tab list
|
// wrap causes the movement to wrap around the start and end of the tab list
|
||||||
// NOTE: position is a 0 based index
|
// NOTE: position is a 0 based index
|
||||||
move: function (tab, spec, wrap)
|
move: function (tab, spec, wrap)
|
||||||
|
|||||||
@@ -275,18 +275,22 @@ vimperator.CommandLine = function () //{{{
|
|||||||
vimperator.options.add(["history", "hi"],
|
vimperator.options.add(["history", "hi"],
|
||||||
"Number of Ex commands and search patterns to store in the commandline history",
|
"Number of Ex commands and search patterns to store in the commandline history",
|
||||||
"number", 500);
|
"number", 500);
|
||||||
|
|
||||||
vimperator.options.add(["more"],
|
vimperator.options.add(["more"],
|
||||||
"Pause the message list window when more than one screen of listings is displayed",
|
"Pause the message list window when more than one screen of listings is displayed",
|
||||||
"boolean", true);
|
"boolean", true);
|
||||||
|
|
||||||
vimperator.options.add(["complete", "cpt"],
|
vimperator.options.add(["complete", "cpt"],
|
||||||
"Items which are completed at the :[tab]open prompt",
|
"Items which are completed at the :[tab]open prompt",
|
||||||
"charlist", "sfbh",
|
"charlist", "sfbh",
|
||||||
{
|
{
|
||||||
validator: function (value) { return !/[^sfbh]/.test(value); }
|
validator: function (value) { return !/[^sfbh]/.test(value); }
|
||||||
});
|
});
|
||||||
|
|
||||||
vimperator.options.add(["showmode", "smd"],
|
vimperator.options.add(["showmode", "smd"],
|
||||||
"Show the current mode in the command line",
|
"Show the current mode in the command line",
|
||||||
"boolean", true);
|
"boolean", true);
|
||||||
|
|
||||||
vimperator.options.add(["wildmode", "wim"],
|
vimperator.options.add(["wildmode", "wim"],
|
||||||
"Define how command line completion works",
|
"Define how command line completion works",
|
||||||
"stringlist", "list:full",
|
"stringlist", "list:full",
|
||||||
@@ -296,6 +300,7 @@ vimperator.CommandLine = function () //{{{
|
|||||||
return value.split(",").every(function (item) { return /^(full|longest|list|list:full|list:longest|)$/.test(item); });
|
return value.split(",").every(function (item) { return /^(full|longest|list|list:full|list:longest|)$/.test(item); });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
vimperator.options.add(["wildoptions", "wop"],
|
vimperator.options.add(["wildoptions", "wop"],
|
||||||
"Change how command line completion is done",
|
"Change how command line completion is done",
|
||||||
"stringlist", "",
|
"stringlist", "",
|
||||||
@@ -306,6 +311,7 @@ vimperator.CommandLine = function () //{{{
|
|||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
var modes = [vimperator.modes.COMMAND_LINE];
|
var modes = [vimperator.modes.COMMAND_LINE];
|
||||||
|
|
||||||
vimperator.mappings.add(modes,
|
vimperator.mappings.add(modes,
|
||||||
|
|||||||
@@ -930,7 +930,7 @@ const vimperator = (function () //{{{
|
|||||||
|
|
||||||
run: function ()
|
run: function ()
|
||||||
{
|
{
|
||||||
func.apply(window, args);
|
func(args);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
/* keep the mozdev header */
|
||||||
|
@import url(http://www.mozdev.org/skin/color/mozdev2k.css);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CSS stylesheet for XHTML produced by DocBook XSL stylesheets.
|
CSS stylesheet for XHTML produced by DocBook XSL stylesheets.
|
||||||
Tested with XSL stylesheets 1.61.2, 1.67.2
|
Tested with XSL stylesheets 1.61.2, 1.67.2
|
||||||
|
|||||||
Reference in New Issue
Block a user