=== modified file 'terminatorlib/terminator.py' --- terminatorlib/terminator.py 2009-02-02 23:01:00 +0000 +++ terminatorlib/terminator.py 2009-02-16 13:44:40 +0000 @@ -918,13 +918,18 @@ edge = current_geo['origin_y'] # botoom edge of the possible target new_edge = possible_geo['origin_y']+possible_geo['span_y'] + + # Width of the horizontal bar that splits terminals + horizontalBar = self.term_list[0].get_parent().style_get_property('handle-size') + self.term_list[0]._titlebox.get_allocation().height + # Vertical distance between two terminals + distance = current_geo['offset_y'] - (possible_geo['offset_y'] + possible_geo['span_y']) if new_edge < edge: #print "new_edge < edge" if best_geo is None: #print "first thing left" return True best_edge = best_geo['origin_y']+best_geo['span_y'] - if new_edge > best_edge: + if new_edge > best_edge and distance == horizontalBar: #print "closer y" return True if new_edge == best_edge: @@ -937,6 +942,9 @@ if abs(new_cursor - cursor) < abs(best_cursor - cursor): #print "closer x" return True + else: + if distance == horizontalBar: + return True #print "fail" return False @@ -950,6 +958,11 @@ # top edge of the possible target new_edge = possible_geo['origin_y'] #print "edge: %d new_edge: %d" % (edge, new_edge) + + # Width of the horizontal bar that splits terminals + horizontalBar = self.term_list[0].get_parent().style_get_property('handle-size') + self.term_list[0]._titlebox.get_allocation().height + # Vertical distance between two terminals + distance = possible_geo['offset_y'] - (current_geo['offset_y'] + current_geo['span_y']) if new_edge > edge: #print "new_edge > edge" if best_geo is None: @@ -957,7 +970,7 @@ return True best_edge = best_geo['origin_y'] #print "best_edge: %d" % (best_edge) - if new_edge < best_edge: + if new_edge < best_edge and distance == horizontalBar: #print "closer y" return True if new_edge == best_edge: @@ -970,6 +983,9 @@ if abs(new_cursor - cursor) < abs(best_cursor - cursor): #print "closer x" return True + else: + if distance == horizontalBar: + return True #print "fail" return False @@ -982,13 +998,23 @@ edge = current_geo['origin_x'] # right-side edge of the possible target new_edge = possible_geo['origin_x']+possible_geo['span_x'] + + # Width of the horizontal bar that splits terminals + horizontalBar = self.term_list[0].get_parent().style_get_property('handle-size') + self.term_list[0]._titlebox.get_allocation().height + # Width of the vertical bar that splits terminals + if self.term_list[0].is_scrollbar_present(): + verticalBar = self.term_list[0].get_parent().style_get_property('handle-size') + self.term_list[0].get_parent().style_get_property('scroll-arrow-vlength') + else: + verticalBar = self.term_list[0].get_parent().style_get_property('handle-size') + # Horizontal distance between two terminals + distance = current_geo['offset_x'] - (possible_geo['offset_x'] + possible_geo['span_x']) if new_edge < edge: #print "new_edge(%d) < edge(%d)" % (new_edge, edge) if best_geo is None: #print "first thing left" return True best_edge = best_geo['origin_x']+best_geo['span_x'] - if new_edge > best_edge: + if new_edge > best_edge and distance == verticalBar: #print "closer x (new_edge(%d) > best_edge(%d))" % (new_edge, best_edge) return True if new_edge == best_edge: @@ -998,7 +1024,7 @@ new_cursor = possible_geo['origin_y'] + possible_geo['cursor_y'] best_cursor = best_geo['origin_y'] + best_geo['cursor_y'] - if abs(new_cursor - cursor) < abs(best_cursor - cursor): + if abs(new_cursor - cursor) < abs(best_cursor - cursor) and distance <> horizontalBar: #print "closer y" return True #print "fail" @@ -1014,6 +1040,16 @@ # left-side edge of the possible target new_edge = possible_geo['origin_x'] #print "edge: %d new_edge: %d" % (edge, new_edge) + + # Width of the horizontal bar that splits terminals + horizontalBar = self.term_list[0].get_parent().style_get_property('handle-size') + self.term_list[0]._titlebox.get_allocation().height + # Width of the vertical bar that splits terminals + if self.term_list[0].is_scrollbar_present(): + verticalBar = self.term_list[0].get_parent().style_get_property('handle-size') + self.term_list[0].get_parent().style_get_property('scroll-arrow-vlength') + else: + verticalBar = self.term_list[0].get_parent().style_get_property('handle-size') + # Horizontal distance between two terminals + distance = possible_geo['offset_x'] - (current_geo['offset_x'] + current_geo['span_x']) if new_edge > edge: #print "new_edge > edge" if best_geo is None: @@ -1021,7 +1057,7 @@ return True best_edge = best_geo['origin_x'] #print "best_edge: %d" % (best_edge) - if new_edge < best_edge: + if new_edge < best_edge and distance == verticalBar: #print "closer x" return True if new_edge == best_edge: @@ -1031,7 +1067,7 @@ new_cursor = possible_geo['origin_y'] + possible_geo['cursor_y'] best_cursor = best_geo['origin_y'] + best_geo['cursor_y'] - if abs(new_cursor - cursor) < abs(best_cursor - cursor): + if abs(new_cursor - cursor) < abs(best_cursor - cursor) and distance <> horizontalBar: #print "closer y" return True #print "fail" === modified file 'terminatorlib/terminatorterm.py' --- terminatorlib/terminatorterm.py 2009-02-13 10:43:11 +0000 +++ terminatorlib/terminatorterm.py 2009-02-16 13:45:15 +0000 @@ -1410,4 +1410,7 @@ label.set_title(title) notebookpage[0].set_tab_label(notebookpage[1], label) notebookpage = self.terminator.get_first_notebook_page(notebookpage[0]) + + def is_scrollbar_present(self): + return self._scrollbar.get_property('visible')