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

"Open Next/Previous Editor" from PDF viewer skips a tab #2055

Closed
samestep opened this issue Apr 28, 2020 · 10 comments
Closed

"Open Next/Previous Editor" from PDF viewer skips a tab #2055

samestep opened this issue Apr 28, 2020 · 10 comments
Labels
enhancement Issue suggests an enhancement

Comments

@samestep
Copy link

samestep commented Apr 28, 2020

Preliminary questions [Required]

Disable all the other extensions except for LaTeX Workshop, and check that you still see this issue. [Required]

You still see this issue?: Yes

Make sure to visit the wiki FAQ before filling an issue.

You visited the wiki?: Yes

Describe the bug [Required]

If I switch to a PDF file using a keyboard shortcut and then also use a keyboard shortcut to run either workbench.action.nextEditor or workbench.action.previousEditor to switch away from the PDF viewer, the adjacent tab is skipped.

To Reproduce

Steps to reproduce the behavior:

  1. Open the following tabs, in order:
    1. A text file.
    2. A text file.
    3. A PDF.
    4. A text file.
    5. A text file.
  2. Use the keyboard shortcut Alt+3 to switch to the third tab.
  3. Use whatever keyboard shortcut is bound to either "View: Open Next Editor" or "View: Open Previous Editor" (Ctrl+PageDown or Ctrl+PageUp by default, respectively).
  4. Note that you are now on either tab 1 or tab 5.

Expected behavior

I expected that the above steps would switch to tab 2 or 4 (adjacent to the PDF tab). This expected behavior occurs if either of the following are done instead of following the above reproduction steps exactly:

  • In step 2, click on the third tab instead of switching to it using a keyboard shortcut.
  • In step 3, run the next/previous editor command directly from the "Show All Commands" palette instead of using a keyboard shortcut.

Logs [Required]

LaTeX Workshop Output [Required]

[12:13:05] Initializing LaTeX Workshop.
[12:13:05] Creating file watcher for .pdf files.
[12:13:05] Creating LaTeX Workshop http and websocket server.
[12:13:06] LaTeX Workshop initialized.
[12:13:06] Server created on 127.0.0.1:35317
[12:13:06] LaTeX Workshop version: 8.9.0
[12:13:06] Snippet data loaded.
[12:13:06] PDF command invoked.
[12:13:06] Serving PDF file at http://localhost:35317/viewer.html?file=pdf..JTJGaG9tZSUyRnNhbSUyRnNhbmRib3glMkZjdHJsdGFiJTJGZmlsZTMucGRm
[12:13:06] The encoded path is /home/sam/sandbox/ctrltab/file3.pdf
[12:13:06] Open PDF tab for /home/sam/sandbox/ctrltab/file3.pdf
[12:13:06] Handle data type: open
[12:13:06] Preview PDF file: /home/sam/sandbox/ctrltab/file3.pdf
[12:13:06] Handle data type: request_params
[12:13:06] Handle data type: loaded
[12:13:15] LOG command invoked.

Developer Tools Console [Required]

[Embedded Page] PDF 647a490e89d573ae024cb6193a3786e4 [1.7 3-Heights(TM) PDF Optimization Shell 4.8.25.2 (http://www.pdf-tools.com) / Microsoft Word] (PDF.js: 2.3.200)

Screenshots

file1
file2
file3
file4
file5

Desktop [Required]

  • OS: Ubuntu 18.04.4
  • VS Code version: 1.44.2
  • Extension version: 8.9.0
  • TeX distribution version: TeX Live 2017

Additional questions

Are you using LaTeX Workshop with VS Code Remote?

No

@jlelong
Copy link
Collaborator

jlelong commented Apr 28, 2020

This looks like #2023 and is mostly not related to the extension

@samestep
Copy link
Author

samestep commented Apr 28, 2020

@jlelong I saw that issue as I was attempting to debug this, but as far as I can tell it doesn't seem to really be the same (although I could very well be wrong) since that one was apparently fixed by upgrading to VS Code 1.43.2, which is older than the version I am currently using. Or am I misunderstanding?

@jlelong
Copy link
Collaborator

jlelong commented Apr 28, 2020

I cannot reproduce your issue with vscode 1.44.2 on OSX.

@jlelong jlelong added can't reproduce Issue cannot be reproduced external issue Issue with something else than LaTeX-Wokshop and removed external issue Issue with something else than LaTeX-Wokshop labels Apr 28, 2020
@samestep

This comment has been minimized.

@tamuratak
Copy link
Contributor

Please down grade to LaTeX Workshop v8.7.2. Check whether you still see this issue.

You can see how to install the old version at https://github.com/James-Yu/LaTeX-Workshop/wiki/FAQ#install-older-version

@samestep
Copy link
Author

@tamuratak That fixes the issue!

@tamuratak
Copy link
Contributor

Enabling the keyboard shortcuts on PDF viewers is tricky since the PDF viewers are implemented with iframe in WebView. See microsoft/vscode#65452 (comment). It seems that we do not need this trick on Linux.

I will disable the following rebroadcasting keyboard events on Linux:

// To enable keyboard shortcuts of VS Code when the iframe is focused,
// we have to dispatch keyboard events in the parent window.
// See https://github.com/microsoft/vscode/issues/65452#issuecomment-586036474
window.addEventListener('message', (e) => {
if (e.origin === 'http://localhost:${this.extension.server.port}') {
window.dispatchEvent(new KeyboardEvent('keydown', e.data));
}
});

I am not sure this change works fine on all the Linux distributions.

@tamuratak tamuratak removed the can't reproduce Issue cannot be reproduced label Apr 29, 2020
tamuratak added a commit to tamuratak/LaTeX-Workshop that referenced this issue Apr 30, 2020
@timfayz
Copy link

timfayz commented Jun 19, 2020

Please down grade to LaTeX Workshop v8.7.2. Check whether you still see this issue.

You can see how to install the old version at https://github.com/James-Yu/LaTeX-Workshop/wiki/FAQ#install-older-version

Thank you for the suggestion, it saved a day! Using Workshop 8.10.0 with VSCode 1.46.0 made the previewer impossible to use again (no tab switching at all + zoom is reset every time you open a terminal or menu bar by pressing Alt).

@tamuratak
Copy link
Contributor

Please open a new issue.

Repository owner locked and limited conversation to collaborators Jun 19, 2020
@tamuratak
Copy link
Contributor

tamuratak commented Jun 19, 2020

@tamuratak tamuratak added the enhancement Issue suggests an enhancement label Oct 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Issue suggests an enhancement
Projects
None yet
Development

No branches or pull requests

4 participants