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

Screen flickers when open a file in new tab #79

Closed
lennylxx opened this issue Nov 21, 2017 · 6 comments
Closed

Screen flickers when open a file in new tab #79

lennylxx opened this issue Nov 21, 2017 · 6 comments

Comments

@lennylxx
Copy link

Repro steps:

  1. Open XiEditor, there will be an open file named Untitled.
  2. Command+O to open a file.
  3. Click around (or use arrow key) to move the cursor in the edit window.

Or reproduced by:

  1. Open XiEditor, there will be an open file named Untitled.
  2. Command+W or click the close button to close this window.
  3. Command+O to open a file named a.txt, this will be in a new window.
  4. Command+T to open a new tab in this window.
  5. Command+O to open another file named b.txt.
  6. Click around (or use arrow key) to move the cursor in the edit window.

Actual result:
Looks like the window is refreshing and there is flash/flickering every time you move the cursor.

Expected result:
No flash/flickering

@raphlinus
Copy link
Member

raphlinus commented Nov 21, 2017

This is known, but it's good to have a bug for it. The underlying problem is that opening a new tab is not sending a scroll RPC to the core, letting the core know the window size.

This might be because viewDidAppear is not getting called, or it's possible that there's an ordering problem so it's being called before a valid scroll notification can be sent.

@raphlinus
Copy link
Member

A looked into this a little, and found that repro was inconsistent (it was particularly hard to repro when I was looking closely). Also, a quick scan of the code shows that it's trying to do the right thing - if the RPC isn't set up, the scroll request goes into a pending queue. So there's something deeper going on here.

@cmyr
Copy link
Member

cmyr commented Dec 16, 2017

Just realized what the bug is, here while working on something related:

When we open in an existing tab, the logic that does the initial line fetch doesn't happen because it is called from the view's viewDidAppear, which happens when we first open the tab but before we open the file.

Not sure what the best solution is, but should be trivial.

cmyr added a commit to cmyr/xi-mac that referenced this issue Dec 27, 2017
This fixes at least part of xi-editor#79; if we were reusing a view (as when
opening a file if the frontmost view was empty) we weren't properly
sending the scroll_to notification.
@cmyr
Copy link
Member

cmyr commented Dec 28, 2017

@lennylxx Would you like to check and see if you can still reproduce this on master? I believe it's fixed, but I had trouble reproducing consistently.

@lennylxx
Copy link
Author

lennylxx commented Jan 4, 2018

@cmyr Build on top of 4603667 and xi-editor/xi-editor@53f4267, it can't be reproduced.
I think it's fixed. Thank you for the work!

@cmyr
Copy link
Member

cmyr commented Jan 4, 2018

@lennylxx great, thanks for the follow-up!

@cmyr cmyr closed this as completed Jan 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants