diff --git a/TODO.md b/TODO.md index dc69474..3056e78 100644 --- a/TODO.md +++ b/TODO.md @@ -9,11 +9,10 @@ ___ ___ ### Change 1. Make **telescope** plugin a generic base to allow query mode additions through plugins -1. Make **lsp_manager** hard coded values configurable, plus add fields to UI +1. Make **lsp_manager** hard coded values configurable, plus add respective fields to UI ___ ### Fix -- Fix to make acive tab on **tabs_bar** scroll to center - Fix **file_state_watcher** to prompt refrsh if external changes applied - Fix on lsp client unload to close files lsp side and unload server endpoint - Fix multi-select left/right block select movement de-sync diff --git a/plugins/code/ui/tabs_bar/plugin.py b/plugins/code/ui/tabs_bar/plugin.py index 1911b6b..12f6160 100644 --- a/plugins/code/ui/tabs_bar/plugin.py +++ b/plugins/code/ui/tabs_bar/plugin.py @@ -1,6 +1,9 @@ # Python imports # Lib imports +import gi + +from gi.repository import Gtk # Application imports from libs.event_factory import Event_Factory, Code_Event_Types @@ -25,8 +28,19 @@ class Plugin(PluginCode): self.register_controller("tabs", self.tabs_controller) - code_container.add( self.tabs_controller.tabs_widget ) - code_container.reorder_child(self.tabs_controller.tabs_widget, 0) + scrolled_win = Gtk.ScrolledWindow() + viewport = Gtk.Viewport() + + scrolled_win.set_overlay_scrolling(False) + scrolled_win.set_size_request(-1, 50) + + viewport.add( self.tabs_controller.tabs_widget ) + scrolled_win.add( viewport ) + code_container.add( scrolled_win ) + code_container.reorder_child(scrolled_win, 0) + + viewport.show() + scrolled_win.show() event = Event_Factory.create_event("get_files") self.emit_to("files", event) diff --git a/plugins/code/ui/tabs_bar/tabs_widget.py b/plugins/code/ui/tabs_bar/tabs_widget.py index 9a8b18d..f4d6af0 100644 --- a/plugins/code/ui/tabs_bar/tabs_widget.py +++ b/plugins/code/ui/tabs_bar/tabs_widget.py @@ -27,7 +27,7 @@ class TabsWidget(Gtk.Notebook): def _setup_styling(self): - self.set_scrollable(True) + ... def _setup_signals(self): self.connect("page-added", self._page_added) @@ -67,6 +67,7 @@ class TabsWidget(Gtk.Notebook): ) self.emit(event) + self._scroll_to_center(tab) def _bind_tab_menu(self, tab, page_widget): def do_context_menu(tab, eve, page_widget): @@ -81,6 +82,21 @@ class TabsWidget(Gtk.Notebook): page_widget ) + def _scroll_to_center(self, tab): + scrolled_win = self.get_parent().get_parent() + alloc = tab.get_allocation() + tab_x = alloc.x + tab_width = alloc.width + view_width = scrolled_win.get_allocated_width() + target = tab_x + tab_width / 2 - view_width / 2 + adj = scrolled_win.get_hadjustment() + lower = adj.get_lower() + upper = adj.get_upper() + page_size = adj.get_page_size() + target = max(lower, min(target, upper - page_size)) + + adj.set_value(target) + def create_menu(self, page_widget) -> Gtk.Menu: context_menu = Gtk.Menu() close_submenu = Gtk.Menu() @@ -130,6 +146,7 @@ class TabsWidget(Gtk.Notebook): self.page_num(page_widget) ) self.handler_unblock(self.switch_page_id) + self._scroll_to_center(tab) break diff --git a/user_config/usr/share/newton/stylesheet.css b/user_config/usr/share/newton/stylesheet.css index 412b82e..5c66b18 100644 --- a/user_config/usr/share/newton/stylesheet.css +++ b/user_config/usr/share/newton/stylesheet.css @@ -63,14 +63,14 @@ scrollbar { scrollbar trough { background-color: transparent; - border-radius: 8px; + border-radius: 4px; } scrollbar slider { background-color: rgba(255, 255, 255, 0.18); - border-radius: 8px; - min-width: 10px; - min-height: 10px; + border-radius: 4px; + min-width: 5px; + min-height: 5px; transition: 120ms ease-in-out; }