diff --git a/terminator b/terminator index fad83d72..1d55febf 100755 --- a/terminator +++ b/terminator @@ -1047,11 +1047,12 @@ class Terminator: pane.show () pane.set_position (position / 2) terminal.show () - terminal.spawn_child () # insert the term reference into the list index = self.term_list.index (widget) - self.term_list.insert (index + 1, terminal) + if pos in ('bottom', 'right'): + index = index + 1 + self.term_list.insert (index, terminal) # make the new terminal grab the focus terminal._vte.grab_focus () @@ -1087,7 +1088,6 @@ class Terminator: #other pages, we insert after the last term of previous page previoustab = notebook.get_nth_page(page_num - 1) sibling = self._notebook_last_term(previoustab) - print sibling siblingindex = self.term_list.index(sibling) for term in termslice: siblingindex += 1 @@ -1116,9 +1116,9 @@ class Terminator: if isinstance(child, TerminatorTerm): return child elif isinstance(child, gtk.Paned): - return self._notebook_first_term(child.get_child2()) + return self._notebook_last_term(child.get_child2()) elif isinstance(child, gtk.Notebook): - return self._notebook_first_term(child.get_nth_page(child.get_n_pages()-1)) + return self._notebook_last_term(child.get_nth_page(child.get_n_pages()-1)) dbg("[ERROR] unsupported class %s in _notebook_last_term" % child.__class__.__name__) return None @@ -1177,8 +1177,12 @@ class Terminator: ## Now, we set focus on the new term notebook.set_current_page(-1) terminal._vte.grab_focus () - - index = self.term_list.index(widget) + + #adding a new tab, thus we need to get the + # last term of the previous tab and add + # the new term just after + sibling = self._notebook_last_term(notebook.get_nth_page(notebook.page_num(terminal)-1)) + index = self.term_list.index(sibling) self.term_list.insert (index + 1, terminal) return (True) @@ -1234,6 +1238,7 @@ class Terminator: grandparent.insert_page(sibling, None,page) grandparent.set_tab_label_packing(sibling, True, True, gtk.PACK_START) grandparent.set_tab_reorderable(sibling, True) + grandparent.set_current_page(page) else: @@ -1271,9 +1276,9 @@ class Terminator: gdparent.remove(parent) gdparent.pack2(sibling) parent.destroy() - if index == 0: index = 1 - self.term_list[index - 1]._vte.grab_focus () - + if index == 0: index = 1 + self.term_list[index - 1]._vte.grab_focus () + self._set_current_notebook_page_recursive(self.term_list[index - 1]) if len(self.term_list) == 1: self.term_list[0]._titlebox.hide() @@ -1296,20 +1301,9 @@ class Terminator: nextterm = self.term_list[next] - if isinstance(nextterm.get_parent(), gtk.Notebook): - box = nextterm - parent = box.get_parent() - for i in range(0, parent.get_n_pages()): - if box == parent.get_nth_page(i): - parent.set_current_page(i) - break - notebookpage = self.get_first_notebook_page(nextterm) - if notebookpage: - child = None - for i in range(0, notebookpage[0].get_n_pages()): - if notebookpage[0].get_nth_page(i) == notebookpage[1]: - notebookpage[0].set_current_page(i) - break + ##we need to set the current page of each notebook + self._set_current_notebook_page_recursive(nextterm) + nextterm._vte.grab_focus () @@ -1324,24 +1318,19 @@ class Terminator: #self.window.set_title(self.term_list[previous]._vte.get_window_title()) previousterm = self.term_list[previous] - if isinstance(previousterm.get_parent(), gtk.Notebook): - box = previousterm - parent = box.get_parent() - for i in range(0, parent.get_n_pages()): - if box == parent.get_nth_page(i): - parent.set_current_page(i) - break - notebookpage = self.get_first_notebook_page(previousterm) - if notebookpage: - child = None - for i in range(0, notebookpage[0].get_n_pages()): - if notebookpage[0].get_nth_page(i) == notebookpage[1]: - notebookpage[0].set_current_page(i) - break + ##we need to set the current page of each notebook + self._set_current_notebook_page_recursive(previousterm) previousterm._vte.grab_focus () - + def _set_current_notebook_page_recursive(self, widget): + page = self.get_first_notebook_page(widget) + while page: + child = None + page_num = page[0].page_num(page[1]) + page[0].set_current_page(page_num) + page = self.get_first_notebook_page(page[0]) + def resizeterm (self, widget, keyname): vertical = False diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 979eae3a..751fef06 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -113,6 +113,7 @@ class TerminatorConfValuestore: 'ignore_hosts' : ['localhost','127.0.0.0/8','*.local'], 'encoding' : 'UTF-8', 'active_encodings' : ['UTF-8', 'ISO-8859-1'], + 'background_image' : '', } def __getattr__ (self, keyname):