Move :window-only to misc.utilcmds

This commit is contained in:
Florian Bruhin 2016-08-16 11:05:02 +02:00
parent 9d7d307aa5
commit 882d1a5e88
2 changed files with 9 additions and 7 deletions

View File

@ -771,13 +771,6 @@ class CommandDispatcher:
raise cmdexc.CommandError("Can't zoom {}%!".format(level))
message.info(self._win_id, "Zoom level: {}%".format(level))
@cmdutils.register(instance='command-dispatcher', scope='window')
def window_only(self):
"""Close all windows except for the current one."""
for win_id, window in objreg.window_registry.items():
if win_id != self._win_id:
window.close()
@cmdutils.register(instance='command-dispatcher', scope='window')
def tab_only(self, left=False, right=False):
"""Close all tabs except for the current one.

View File

@ -247,3 +247,12 @@ def log_capacity(capacity: int):
raise cmdexc.CommandError("Can't set a negative log capacity!")
else:
log.ram_handler.change_log_capacity(capacity)
@cmdutils.register()
@cmdutils.argument('current_win_id', win_id=True)
def window_only(current_win_id):
"""Close all windows except for the current one."""
for win_id, window in objreg.window_registry.items():
if win_id != current_win_id:
window.close()