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

sublime 3143 git gutter inconsistencies on scroll #452

Closed
joernhees opened this issue Sep 22, 2017 · 10 comments
Closed

sublime 3143 git gutter inconsistencies on scroll #452

joernhees opened this issue Sep 22, 2017 · 10 comments
Labels

Comments

@joernhees
Copy link

first of all thanks for gitgutter, awesome plugin.

since the latest sublime update, some of the gutter marks are lost on scroll for me: if i scroll the current region out of sight and quickly back into sight, some parts aren't marked as modified anymore. The following screenshots were taken seconds apart, nothing modified, simple scroll down and back up:
image image

I don't see any errors in the console log, and on click or scroll left/right the gutter is redrawn and corrected... the minimap marks seem correct, making it more weird... when you grab it and quickly scroll to a region with many changes, sometimes nothing in the git gutter is marked?!?

Support Info

  • Sublime Text 3143
  • Platform: osx
  • Arch: x64
  • GitGutter Version could not be acquired!
  • Install via PC: True
  • git version 2.14.1
  • mdpopups 2.1.1
  • markdown 2.6.9
  • pygments 2.1a0
  • jinja2 2.8

Already tried playing around with debounce_delay and diff_algorithm, no effect.

@deathaxe
Copy link
Collaborator

GitGutter doesn't update the icons by pure scrolling - only after loading/saving a file, activating a view or content modification. Therefore

  1. icons added to a line are not cleared by GitGutter in any way
  2. and any changes in settings don't have any effect.

The icons and the markers in the minimap are created by the same API function view.add_regions(). So if the minimap markers show correctly, GitGutter seems to correctly pass the required information to ST.

If another package temporarily adds icons to a line which has been occupied by GitGutter, GitGutter's icons are dropped, which would look like missing icons then. There are several packages out there which add icons to the gutter asynchronously. Maybe one of them is fighting with GitGutter's icons. I don't have an idea whether and how this could be related to quick scrolling.

Could you try to setup a clean installation of ST with PC, GitGutter and its dependencies added only to check whether the issue remains?

@joernhees
Copy link
Author

ok, closed ST, moved ~/Library/Application Support/Sublime Text 3 dir out of the way, restarted, installed PC, installed GitGutter, closed ST and restarted, same result (but agreeably much less frequent):

screen shot 2017-09-23 at 12 19 24 screen shot 2017-09-23 at 12 19 12

not knowing anything about how ST draws the gutter icons, but is there maybe some race condition / timeout?
As i said, i'm quite sure that this only happens since the latest ST release, did they maybe change something there?

@deathaxe
Copy link
Collaborator

deathaxe commented Sep 23, 2017

Hmm, strange. In that case there are two last chances to find out whether the issue is caused by GitGutter.

In order to fix issue #446 GitGutter 1.7.5 uses real threads to evaluate and add the icons. ST API is considered thread safe but maybe its buggy somehow.

To check that, you could try to temporarily revert to GitGutter 1.7.4, which uses set_timeout_async() to do so.

  1. Download https://github.com/jisaacks/GitGutter/archive/1.7.4.zip
  2. Rename it to GitGutter.sublime-package
  3. Place it into ~/Library/Application Support/Sublime Text 3/Installed Packages and replace the current one. (Hope PC doesn't update it immediately)

If the issue still remains then, you could try to use the console to add a bunch of icons and check whether they remain in the gutter after scrolling. Will create a little helper for that.

EDIT:

  1. Create a "debug_regions.py" in our User folder
  2. Paste the following content.
import sublime
import sublime_plugin


class DebugAddRegionsCommand(sublime_plugin.TextCommand):

    def run(self, edit):
        sublime.set_timeout_async(self.run_async, 0)


    def run_async(self):
        region = sublime.Region(0, self.view.size())
        regions = [sublime.Region(r.a, r.a + 1) for r in self.view.lines(region)]

        self.view.add_regions(
            'debug_region',
            regions=regions,
            scope='markup.changed',
            icon='Packages/Theme - Default/common/dot.png',
            flags=sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE)


class DebugClearRegionsCommand(sublime_plugin.TextCommand):

    def run(self, edit):
        self.view.erase_regions('debug_region')
  1. In console you can run: view.run_command("debug_add_regions") to add a region to each line.
  2. Try scrolling and check whether gaps appear.
  3. In console you can run: view.run_command("debug_clear_regions") to remove the regions.

@joernhees
Copy link
Author

joernhees commented Sep 23, 2017

if i do that ST completely freezes shortly after i try scrolling in the file

after force-quit, it works, but GitGutter seems to be disabled... (i don't see any gutter icons, in console there's no loading message for the plugin and all options in Preferences / Package Settings / GitGutter are greyed out)

I also noticed that the dependencies in ~/Library/ApplicationSupport/Sublime Text 3/Packages/ are suddenly gone?!?

@joernhees
Copy link
Author

joernhees commented Sep 23, 2017

ok, did some more testing by re-installing git gutter via PC, then unzipping the above link into <subl>/Packages/, renaming the folder to GitGutter and deleting the <subl>/Installed Packages/GitGutter.sublime-package and restarting ST... this time it comes up, GitGutter is working, but the bug remains (gutter icons disappear on scroll).

Is this maybe a ST bug? maybe https://forum.sublimetext.com/t/bug-disappear-icons-in-the-gutter-and-the-tabs-row/5957 ? quite old though

@deathaxe
Copy link
Collaborator

Sorry, didn't notice the zipfile to contain a single directory with the content being downloaded.

With the issue remaining after reverting to GitGutter 1.7.4 I am quite sure it's a bug in ST. The gutter icon rendering was updated recently to correctly support the 4k screens and fix an issue with heavy CPU usage caused by many regions added.

If we file an issue in the core section, the question will arise to create some procedure to reproduce the issue without any packages being installed. To really proof this issue is caused by the core, I would like to ask you one last thing to do.

Please move away the data directory again. Then paste the content of the code snippets from my last post to a python file within the new User directory, open a (large?) file which is not located within a git repository (to keep GitGutter disabled) and run the mentioned command from console.

Just paste view.run_command("debug_add_regions") to the console and hit enter. This will add an icon to each row in your document. If those icons get lost, too, its definitely a core issue.

@joernhees
Copy link
Author

joernhees commented Sep 23, 2017

yepp, same problem... completely vanilla ST dir, opened the debug_regions.py file from within it, paste the code but add newlines so the file is 600 lines long. Then view.run_command("debug_add_regions") and scroll ;) Can you reproduce this or is it just on my system?

no clue how to take this upstream to ST though :-/

@joernhees
Copy link
Author

problem actually also already exists with 50 lines if you make the window small and scoll fast enough... the more lines the easier though...

@deathaxe
Copy link
Collaborator

I can't reproduce this issue. Gutter icons are rock stable on Windows. Seems to be an OS related issue.

I've created an issue sublimehq/sublime_text#1947. Could you please provide information to complete the environment section?

@joernhees
Copy link
Author

👍 thanks for debugging this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants