Skip to content

Commit

Permalink
Reinstate the scrollbar sync workaround
Browse files Browse the repository at this point in the history
This workaround fixes howl-editor#567 and generally makes the scrollbars
behave more predictably.

It was originally introduced in e83e98e
as a fix for issue howl-editor#371.

Then it was removed in f7c84b6
  • Loading branch information
dgaw committed Sep 11, 2020
1 parent aac43f6 commit d3e3eae
Showing 1 changed file with 13 additions and 1 deletion.
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

0 comments on commit d3e3eae

Please sign in to comment.