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

Reinstate the scrollbar sync workaround #583

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/aullar/view.moon
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
ffi = require 'ffi'
bit = require 'bit'
ffi_cast = ffi.cast
callbacks = require 'ljglibs.callbacks'

Gdk = require 'ljglibs.gdk'
Gtk = require 'ljglibs.gtk'
Expand All @@ -21,6 +22,8 @@ config = require 'aullar.config'
{:define_class} = require 'aullar.util'
{:parse_key_event} = require 'ljglibs.util'
{:max, :min, :floor} = math
cast_arg = callbacks.cast_arg
C = ffi.C
append = table.insert

jit.off true, true
Expand Down Expand Up @@ -151,6 +154,9 @@ View = {
@buffer = buffer
@config\add_listener self\_on_config_changed

@_refresh_cb_handle = callbacks.register self\_sync_scrollbars, "view-#{@}-refresh"
@_cb_handler = callbacks.unref_handle @_refresh_cb_handle

destroy: =>
@bin\destroy!

Expand Down Expand Up @@ -885,9 +891,15 @@ View = {
@last_visible_line = @last_visible_line

@buffer\ensure_styled_to line: @last_visible_line + 1
@_sync_scrollbars!
notify @, 'on_resized'

-- we just can't sync the scrollbars here due to a Gtk issue, so we
-- work around this by syncing these immediately after the size_allocate
-- handling is done
-- Ref: https://bugzilla.gnome.org/show_bug.cgi?id=765410
C.g_timeout_add_full C.G_PRIORITY_LOW, 0, callbacks.source_func,
cast_arg(@_refresh_cb_handle.id), nil

_on_config_changed: (option, val, old_val) =>
if option == 'view_font_name' or option == 'view_font_size'
@area\override_font Pango.FontDescription {
Expand Down