Loop around tabs when using next_tab or prev_tab keyboard shortcuts. Closes LP #315494

This commit is contained in:
Chris Jones 2009-01-10 01:55:46 +00:00
parent 533e85e2a7
commit dec20d4069
1 changed files with 12 additions and 2 deletions

View File

@ -1098,6 +1098,11 @@ class Terminator:
def previous_tab(self, term): def previous_tab(self, term):
notebook = self.get_first_parent_notebook(term) notebook = self.get_first_parent_notebook(term)
if notebook: if notebook:
cur = notebook.get_current_page()
pages = notebook.get_n_pages()
if cur == 0:
notebook.set_current_page(pages - 1)
else:
notebook.prev_page() notebook.prev_page()
# This seems to be required in some versions of (py)gtk. # This seems to be required in some versions of (py)gtk.
# Without it, the selection changes, but the displayed page doesn't change # Without it, the selection changes, but the displayed page doesn't change
@ -1107,6 +1112,11 @@ class Terminator:
def next_tab(self, term): def next_tab(self, term):
notebook = self.get_first_parent_notebook(term) notebook = self.get_first_parent_notebook(term)
if notebook: if notebook:
cur = notebook.get_current_page()
pages = notebook.get_n_pages()
if cur == pages - 1:
notebook.set_current_page(0)
else:
notebook.next_page() notebook.next_page()
notebook.set_current_page(notebook.get_current_page()) notebook.set_current_page(notebook.get_current_page())