Improved focus logic when ctrl+shift+up/down an edit window

This commit is contained in:
itdominator 2023-11-11 00:22:50 -06:00
parent 37bff1eb3d
commit 6fa201709b
1 changed files with 20 additions and 19 deletions

View File

@ -65,36 +65,39 @@ class EditorEventsMixin:
self.set_current_page(page_num)
def keyboard_move_tab_to_1(self, page_num):
if self.NAME == "notebook_1": return
notebook = self.builder.get_object("notebook_1")
if self.NAME == "notebook_1":
if self.get_n_pages() == 1:
return
page = self.get_nth_page(page_num)
tab = page.get_tab_widget()
notebook = self.builder.get_object("notebook_2")
page = self.get_nth_page(page_num)
tab = page.get_tab_widget()
self.detach_tab(page)
notebook.insert_page(page, tab, -1)
notebook.show()
notebook.insert_page(page, tab, -1)
if self.get_n_pages() == 0:
self.hide()
notebook.set_current_page(-1)
page.get_children()[0].grab_focus()
def keyboard_move_tab_to_2(self, page_num):
if self.NAME == "notebook_2":
return
if self.NAME == "notebook_1" and self.get_n_pages() == 1:
return
notebook = self.builder.get_object("notebook_2")
if self.NAME == "notebook_2":
notebook = self.builder.get_object("notebook_1")
page = self.get_nth_page(page_num)
tab = page.get_tab_widget()
page = self.get_nth_page(page_num)
tab = page.get_tab_widget()
self.detach_tab(page)
notebook.insert_page(page, tab, -1)
notebook.show()
if self.NAME == "notebook_2" and self.get_n_pages() == 0:
self.hide()
notebook.insert_page(page, tab, -1)
notebook.set_current_page(-1)
page.get_children()[0].grab_focus()
def keyboard_move_tab_left(self, page_num):
page = self.get_nth_page(page_num)
@ -107,8 +110,6 @@ class EditorEventsMixin:
self.reorder_child(page, page_num)
# NOTE: These feel bad being here man...
def scale_up_text(self, source_view):
source_view.scale_up_text()