summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViacheslav Chimishuk <vchimishuk@yandex.ru>2018-09-27 23:54:13 +0300
committerViacheslav Chimishuk <vchimishuk@yandex.ru>2018-09-27 23:54:13 +0300
commit232574212d9a2448ccdf5109ce65e32e9a013609 (patch)
treeaf70a5154eee5cb7a14647673f0822a9a1fdd075
parentd4e388f9d57dd0429230005d2538e4b3f8e2a136 (diff)
downloadqutebrowser-232574212d9a2448ccdf5109ce65e32e9a013609.tar.gz
qutebrowser-232574212d9a2448ccdf5109ce65e32e9a013609.zip
Add zoom, zoom-in and zoom-out --quiet option support.
-rw-r--r--doc/help/commands.asciidoc15
-rw-r--r--qutebrowser/browser/commands.py21
2 files changed, 29 insertions, 7 deletions
diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc
index 51d3b30a9..eb7338fac 100644
--- a/doc/help/commands.asciidoc
+++ b/doc/help/commands.asciidoc
@@ -1413,7 +1413,7 @@ Yank something to the clipboard or primary selection.
[[zoom]]
=== zoom
-Syntax: +:zoom ['zoom']+
+Syntax: +:zoom [*--quiet*] ['zoom']+
Set the zoom level for the current tab.
@@ -1422,20 +1422,33 @@ The zoom can be given as argument or as [count]. If neither is given, the zoom i
==== positional arguments
* +'zoom'+: The zoom percentage to set.
+==== optional arguments
+* +*-q*+, +*--quiet*+: Don't show information message with result.
+
==== count
The zoom percentage to set.
[[zoom-in]]
=== zoom-in
+Syntax: +:zoom-in [*--quiet*]+
+
Increase the zoom level for the current tab.
+==== optional arguments
+* +*-q*+, +*--quiet*+: Don't show information message with result.
+
==== count
How many steps to zoom in.
[[zoom-out]]
=== zoom-out
+Syntax: +:zoom-out [*--quiet*]+
+
Decrease the zoom level for the current tab.
+==== optional arguments
+* +*-q*+, +*--quiet*+: Don't show information message with result.
+
==== count
How many steps to zoom out.
diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py
index a66a8fdea..3d7746e73 100644
--- a/qutebrowser/browser/commands.py
+++ b/qutebrowser/browser/commands.py
@@ -870,37 +870,44 @@ class CommandDispatcher:
@cmdutils.register(instance='command-dispatcher', scope='window')
@cmdutils.argument('count', count=True)
- def zoom_in(self, count=1):
+ @cmdutils.argument('quiet', flag='q')
+ def zoom_in(self, count=1, quiet=False):
"""Increase the zoom level for the current tab.
Args:
count: How many steps to zoom in.
+ quiet: Don't show information message with result.
"""
tab = self._current_widget()
try:
perc = tab.zoom.offset(count)
except ValueError as e:
raise cmdexc.CommandError(e)
- message.info("Zoom level: {}%".format(int(perc)), replace=True)
+ if not quiet:
+ message.info("Zoom level: {}%".format(int(perc)), replace=True)
@cmdutils.register(instance='command-dispatcher', scope='window')
@cmdutils.argument('count', count=True)
- def zoom_out(self, count=1):
+ @cmdutils.argument('quiet', flag='q')
+ def zoom_out(self, count=1, quiet=False):
"""Decrease the zoom level for the current tab.
Args:
count: How many steps to zoom out.
+ quiet: Don't show information message with result.
"""
tab = self._current_widget()
try:
perc = tab.zoom.offset(-count)
except ValueError as e:
raise cmdexc.CommandError(e)
- message.info("Zoom level: {}%".format(int(perc)), replace=True)
+ if not quiet:
+ message.info("Zoom level: {}%".format(int(perc)), replace=True)
@cmdutils.register(instance='command-dispatcher', scope='window')
@cmdutils.argument('count', count=True)
- def zoom(self, zoom=None, count=None):
+ @cmdutils.argument('quiet', flag='q')
+ def zoom(self, zoom=None, count=None, quiet=False):
"""Set the zoom level for the current tab.
The zoom can be given as argument or as [count]. If neither is
@@ -910,6 +917,7 @@ class CommandDispatcher:
Args:
zoom: The zoom percentage to set.
count: The zoom percentage to set.
+ quiet: Don't show information message with result.
"""
if zoom is not None:
try:
@@ -927,7 +935,8 @@ class CommandDispatcher:
tab.zoom.set_factor(float(level) / 100)
except ValueError:
raise cmdexc.CommandError("Can't zoom {}%!".format(level))
- message.info("Zoom level: {}%".format(int(level)), replace=True)
+ if not quiet:
+ message.info("Zoom level: {}%".format(int(level)), replace=True)
@cmdutils.register(instance='command-dispatcher', scope='window')
def tab_only(self, prev=False, next_=False, force=False):