Implement wrapping/message when switching tabs
This commit is contained in:
parent
3ab3e9394d
commit
76f4917ae9
@ -188,6 +188,10 @@ DATA = OrderedDict([
|
|||||||
('last_close',
|
('last_close',
|
||||||
SettingValue(types.LastClose(), "ignore"),
|
SettingValue(types.LastClose(), "ignore"),
|
||||||
"Behaviour when the last tab is closed."),
|
"Behaviour when the last tab is closed."),
|
||||||
|
|
||||||
|
('wrap',
|
||||||
|
SettingValue(types.Bool(), "true"),
|
||||||
|
"Whether to wrap when changing tabs."),
|
||||||
)),
|
)),
|
||||||
|
|
||||||
('webkit', sect.KeyValue(
|
('webkit', sect.KeyValue(
|
||||||
|
@ -278,12 +278,13 @@ class TabbedBrowser(TabWidget):
|
|||||||
Args:
|
Args:
|
||||||
count: How many tabs to switch back.
|
count: How many tabs to switch back.
|
||||||
"""
|
"""
|
||||||
idx = self.currentIndex()
|
newidx = self.currentIndex() - count
|
||||||
if idx - count >= 0:
|
if newidx >= 0:
|
||||||
self.setCurrentIndex(idx - count)
|
self.setCurrentIndex(newidx)
|
||||||
|
elif config.get('tabbar', 'wrap'):
|
||||||
|
self.setCurrentIndex(newidx % self.count())
|
||||||
else:
|
else:
|
||||||
# FIXME display message or wrap
|
message.info("First tab")
|
||||||
pass
|
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs', name='tabnext')
|
@cmdutils.register(instance='mainwindow.tabs', name='tabnext')
|
||||||
def switch_next(self, count=1):
|
def switch_next(self, count=1):
|
||||||
@ -294,12 +295,13 @@ class TabbedBrowser(TabWidget):
|
|||||||
Args:
|
Args:
|
||||||
count: How many tabs to switch forward.
|
count: How many tabs to switch forward.
|
||||||
"""
|
"""
|
||||||
idx = self.currentIndex()
|
newidx = self.currentIndex() + count
|
||||||
if idx + count < self.count():
|
if newidx < self.count():
|
||||||
self.setCurrentIndex(idx + count)
|
self.setCurrentIndex(newidx)
|
||||||
|
elif config.get('tabbar', 'wrap'):
|
||||||
|
self.setCurrentIndex(newidx % self.count())
|
||||||
else:
|
else:
|
||||||
# FIXME display message or wrap
|
message.info("Last tab")
|
||||||
pass
|
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs', nargs=(0, 1))
|
@cmdutils.register(instance='mainwindow.tabs', nargs=(0, 1))
|
||||||
def paste(self, sel=False, tab=False):
|
def paste(self, sel=False, tab=False):
|
||||||
|
Loading…
Reference in New Issue
Block a user