Add focus_tab command
This commit is contained in:
parent
0d1ada27fd
commit
8ada39ff8b
1
TODO
1
TODO
@ -48,7 +48,6 @@ somehow unfocus elements (hide blinking cursor) when insert mode is left?
|
|||||||
tabs: some more padding?
|
tabs: some more padding?
|
||||||
exec command for shell
|
exec command for shell
|
||||||
custom stylesheet
|
custom stylesheet
|
||||||
Alt+N to focus tab N
|
|
||||||
Really fix URL detection properly
|
Really fix URL detection properly
|
||||||
|
|
||||||
hints
|
hints
|
||||||
|
@ -505,6 +505,15 @@ DATA = OrderedDict([
|
|||||||
('<Ctrl-B>', 'scroll_page 0 -1'),
|
('<Ctrl-B>', 'scroll_page 0 -1'),
|
||||||
('<Ctrl-D>', 'scroll_page 0 0.5'),
|
('<Ctrl-D>', 'scroll_page 0 0.5'),
|
||||||
('<Ctrl-U>', 'scroll_page 0 -0.5'),
|
('<Ctrl-U>', 'scroll_page 0 -0.5'),
|
||||||
|
('<Alt-1>', 'focus_tab 1'),
|
||||||
|
('<Alt-2>', 'focus_tab 2'),
|
||||||
|
('<Alt-3>', 'focus_tab 3'),
|
||||||
|
('<Alt-4>', 'focus_tab 4'),
|
||||||
|
('<Alt-5>', 'focus_tab 5'),
|
||||||
|
('<Alt-6>', 'focus_tab 6'),
|
||||||
|
('<Alt-7>', 'focus_tab 7'),
|
||||||
|
('<Alt-8>', 'focus_tab 8'),
|
||||||
|
('<Alt-9>', 'focus_tab 9'),
|
||||||
('<Backspace>', 'back'),
|
('<Backspace>', 'back'),
|
||||||
('<Left>', '${h}'),
|
('<Left>', '${h}'),
|
||||||
('<Down>', '${j}'),
|
('<Down>', '${j}'),
|
||||||
|
@ -322,6 +322,23 @@ class TabbedBrowser(TabWidget):
|
|||||||
"""
|
"""
|
||||||
self.paste(sel, True)
|
self.paste(sel, True)
|
||||||
|
|
||||||
|
@cmdutils.register(instance='mainwindow.tabs')
|
||||||
|
def focus_tab(self, arg=None, count=None):
|
||||||
|
if ((arg is None and count is None) or
|
||||||
|
(arg is not None and count is not None)):
|
||||||
|
message.error("Either argument or count must be given!")
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
idx = int(arg) if arg is not None else count
|
||||||
|
except ValueError:
|
||||||
|
message.error("Invalid argument: {}".format(arg))
|
||||||
|
return
|
||||||
|
if 1 <= idx <= self.count():
|
||||||
|
self.setCurrentIndex(idx - 1)
|
||||||
|
else:
|
||||||
|
message.error("Index out of bounds!")
|
||||||
|
return
|
||||||
|
|
||||||
@pyqtSlot(str, str)
|
@pyqtSlot(str, str)
|
||||||
def on_config_changed(self, section, option):
|
def on_config_changed(self, section, option):
|
||||||
"""Update tab config when config was changed."""
|
"""Update tab config when config was changed."""
|
||||||
|
Loading…
Reference in New Issue
Block a user