Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance scrollbar #916

Merged
merged 5 commits into from
Apr 14, 2022
Merged

Enhance scrollbar #916

merged 5 commits into from
Apr 14, 2022

Conversation

Guldoman
Copy link
Member

This makes the scrollbar more interactive, by increasing its visibility and allowing clicking on the "track" to move to the corresponding part of the document.

Kooha-04-12-2022-03-24-02.mp4

This breaks the minimap plugin, but can be fixed with something like:

@@ -190,6 +190,14 @@ DocView.get_scrollbar_rect = function(self)
 	       self.position.y, config.plugins.minimap.width * SCALE, self.size.y
 end
 
+local prev_get_scrollbar_track_rect = DocView.get_scrollbar_track_rect
+DocView.get_scrollbar_track_rect = function(self)
+	if not show_minimap() then return prev_get_scrollbar_track_rect(self) end
+
+	return self.position.x + self.size.x - config.plugins.minimap.width * SCALE,
+	       self.position.y, config.plugins.minimap.width * SCALE, self.size.y
+end
+
 -- Overloaded so we can render the minimap in the "scrollbar area".
 local prev_draw_scrollbar = DocView.draw_scrollbar
 DocView.draw_scrollbar = function(self)

Other plugins might need testing.

@jgmdev
Copy link
Member

jgmdev commented Apr 14, 2022

Tested all plugins on the lite-xl-plugins 2.1 branch that referenced the scrollbar and indeed only the minimap needed the fix you posted. After several days this change is working nicely, will merge it and apply your minimap patch to the 2.1 plugins branch.

@jgmdev jgmdev merged commit c0970f4 into lite-xl:master Apr 14, 2022
@jgmdev
Copy link
Member

jgmdev commented Apr 14, 2022

For reference the minimap change lite-xl/lite-xl-plugins@4fd2042

@Guldoman Guldoman mentioned this pull request Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants