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

Line numbers invisible after Zen Mode toggled off #90240

Closed
10bo opened this issue Feb 7, 2020 · 12 comments
Closed

Line numbers invisible after Zen Mode toggled off #90240

10bo opened this issue Feb 7, 2020 · 12 comments

Comments

@10bo
Copy link

@10bo 10bo commented Feb 7, 2020

  • VSCode Version: 1.41.1 (user setup)
  • OS Version: Windows_NT x64 10.0.18362

Steps to Reproduce:

  1. Ensure you have at least one file open in editor
  2. Enable Zen Mode
  3. Click on a file in the Source Control tab under the CHANGES sub-heading to open the side-by-side diff
  4. Disable Zen Mode
  5. Click on the tab for the file opened in step 1 & observe the area where line numbers should appear

image

Does this issue occur when all extensions are disabled?: Yes

@vscodebot

This comment has been minimized.

@isidorn

This comment has been minimized.

Copy link
Contributor

@isidorn isidorn commented Feb 10, 2020

I acknowledge this issue.
The problem is how we reset the line numbers after exiting zen mode
Code pointer

setLineNumbers();

An elegant PR that fixes this is welcome.
We might also look into this in the future.

@isidorn isidorn added the bug label Feb 10, 2020
@isidorn isidorn added this to the Backlog milestone Feb 10, 2020
@jeanp413

This comment has been minimized.

Copy link
Contributor

@jeanp413 jeanp413 commented Feb 10, 2020

@isidorn I took a look at this and to fix this we need not just the visibleTextEditorWidgets but the non-visible ones too. I looked around and it seems there is no method for this in IEditorService or IEditorGroupsService
There is an array in EditorControl that holds the visible and non-visible editors, would it be fine to expose this variable ?

private controls: BaseEditor[] = [];

@isidorn

This comment has been minimized.

Copy link
Contributor

@isidorn isidorn commented Feb 11, 2020

@jeanp413 thanks for looking into this. That sounds reasonable. However let's check with @bpasero if he wants to expose non visible editors in the editorService or if he has a better suggestion for this.

Alternative would be to remember all the editors that we have hidden line numbers for, and then when bringing them back to go through those editors.

@bpasero

This comment has been minimized.

Copy link
Member

@bpasero bpasero commented Feb 11, 2020

@isidorn IEditorService#editors gives access to all opened editors.

@isidorn

This comment has been minimized.

Copy link
Contributor

@isidorn isidorn commented Feb 11, 2020

Ok thanks. @jeanp413 so that + .getControl() should probably give you all the editorWidgets.

@jeanp413

This comment has been minimized.

Copy link
Contributor

@jeanp413 jeanp413 commented Feb 11, 2020

IEditorService#editors gives an array of IEditorInput which doesn't have a .getControl() method.
Is there a way to get a BaseEditor from an IEditorInput?

@isidorn

This comment has been minimized.

Copy link
Contributor

@isidorn isidorn commented Feb 12, 2020

I believe the Editor control only exists for the visible editors (thus we create just one editor per Group). To save on resources.
So I believe the correct way to fix this is to remember all the editors that we have hidden line numbers for, and then when bringing them back to go through those editors.

@bpasero can correct me if I am wrong. Thansk

@bpasero

This comment has been minimized.

Copy link
Member

@bpasero bpasero commented Feb 12, 2020

Yes, for performance reasons we only allocate 1 editor control per visible tab, not for each tab that is hidden.

@jeanp413

This comment has been minimized.

Copy link
Contributor

@jeanp413 jeanp413 commented Feb 17, 2020

I pushed 2 branches with different fixes for this issue

  1. https://github.com/jeanp413/vscode/tree/zen-mode-linenumbers-1
    This branch fixes it by using a Set to remember all the editor we have hidden line numbers as isidorn suggested. Not sure if it's safe to call updateOptions on disposed editor widgets (this could happen if we have multiple editor groups and we close any of them)
  2. https://github.com/jeanp413/vscode/tree/zen-mode-linenumbers-2
    This branch fixes it by exposing the controls array in EditorControl and updating the IEditorGroup and IEditorService interfaces

@isidorn let me know which approach is preferred to create the corresponding PR

@isidorn

This comment has been minimized.

Copy link
Contributor

@isidorn isidorn commented Feb 17, 2020

@jeanp413 let's go with approach 1. Once you create the PR i can further comment on it. Thanks a lot!

@isidorn

This comment has been minimized.

Copy link
Contributor

@isidorn isidorn commented Feb 18, 2020

Thanks @jeanp413 for fixing this 👏

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

Successfully merging a pull request may close this issue.

5 participants
You can’t perform that action at this time.