mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 10:57:58 +01:00
use argCount: "?" with :zoom
This commit is contained in:
@@ -599,22 +599,23 @@ function Buffer() //{{{
|
|||||||
"Set zoom value of current web page",
|
"Set zoom value of current web page",
|
||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
|
let arg = args[0];
|
||||||
let level;
|
let level;
|
||||||
|
|
||||||
if (!args.string)
|
if (!arg)
|
||||||
{
|
{
|
||||||
level = 100;
|
level = 100;
|
||||||
}
|
}
|
||||||
else if (/^\d+$/.test(args.string))
|
else if (/^\d+$/.test(arg))
|
||||||
{
|
{
|
||||||
level = parseInt(args.string, 10);
|
level = parseInt(arg, 10);
|
||||||
}
|
}
|
||||||
else if (/^[+-]\d+$/.test(args.string))
|
else if (/^[+-]\d+$/.test(arg))
|
||||||
{
|
{
|
||||||
if (args.bang)
|
if (args.bang)
|
||||||
level = buffer.fullZoom + parseInt(args.string, 10);
|
level = buffer.fullZoom + parseInt(arg, 10);
|
||||||
else
|
else
|
||||||
level = buffer.textZoom + parseInt(args.string, 10);
|
level = buffer.textZoom + parseInt(arg, 10);
|
||||||
|
|
||||||
// relative args shouldn't take us out of range
|
// relative args shouldn't take us out of range
|
||||||
if (level < ZOOM_MIN)
|
if (level < ZOOM_MIN)
|
||||||
@@ -633,7 +634,10 @@ function Buffer() //{{{
|
|||||||
else
|
else
|
||||||
buffer.textZoom = level;
|
buffer.textZoom = level;
|
||||||
},
|
},
|
||||||
{ bang: true });
|
{
|
||||||
|
argCount: "?",
|
||||||
|
bang: true
|
||||||
|
});
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// PAGE INFO ///////////////////////////////////////////////
|
////////////////////// PAGE INFO ///////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user