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

regression: Noticeable latency of Zathura backward search after a recently merged commit #2150

Closed
moetayuko opened this issue Aug 27, 2021 · 3 comments
Labels

Comments

@moetayuko
Copy link
Contributor

Description

The cursor should move right after ctrl+mouse click. However, after 8aa70e4 there's a nearly 1-second latency.

ps: the latency depends on the performance of vim. No additional plugins that potentially slow down vim are loaded with the minimal.vim below, so the latency is relatively low (but still noticeable and enough to reproduce the issue).

Steps to reproduce

minimal.vim

call plug#begin()
 Plug 'lervag/vimtex'
call plug#end()

set nocp

call remote_startserver('VIM')
let g:vimtex_view_method = 'zathura'

minimal.tex

\documentclass{minimal}
\begin{document}
Hello world!
\end{document}
  1. vim -u minimal.vim minimal.tex
  2. ctrl+mouse click someplace in Zathura

Expected behavior

Workflow before (expected):

  1. ctrl+mouse click someplace in Zathura, vim cursor moved right after that.
  2. Manually activate vim window and continue editing.

Actual behavior

Workflow after:

  1. ctrl+mouse click someplace in Zathura, vim highlighted line moved right after that, but the cursor disappears.
  2. If activating vim window before the cursor reappears, a terminal control sequence ^[[I appears at the last line of the text, but the cursor is still invisible.
  3. The cursor reappears after 1s, but Zathura window automatically gets activated at the same time.
  4. One have to activate vim window again to continue edit.

So the problems are:

  1. Long delay of the cursor after triggering a backward search
  2. Weird behavior of activated window

and they got fixed after reverting the commit above.

Do you use a latexmkrc file?

No

VimtexInfo

System info
  OS: Arch Linux
  Vim version: VIM 8.2 (1-2891)
  Has clientserver: true
  Servername: VIM

VimTeX project: minimal
  base: minimal.tex
  root: /home/dianlujitao/test
  tex: /home/dianlujitao/test/minimal.tex
  main parser: current file verified
  document class: minimal
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
    process: 
      jobid: process 3036321 run
      output: /tmp/veh55NQ/2
      cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e '$new_viewer_always = "0"' -e '$pdf_previewer = "zathura  -x \"/usr/bin/vim --servername VIM --remote-expr \"\\\"\"vimtex#view#reverse_goto(\%{line}, '"'"'\%{input}'"'"')\"\\\"\"\" \%S"' -e '$compiling_cmd = ($compiling_cmd ? $compiling_cmd . " ; " : "") . "echo vimtex_compiler_callback_compiling"' -e '$success_cmd = ($success_cmd ? $success_cmd . " ; " : "") . "echo vimtex_compiler_callback_success"' -e '$failure_cmd = ($failure_cmd ? $failure_cmd . " ; " : "") . "echo vimtex_compiler_callback_failure"' 'minimal.tex'
      pid: 3036321
  viewer: Zathura
    xwin id: 125829123
  qf method: LaTeX logfile
@moetayuko moetayuko added the bug label Aug 27, 2021
lervag added a commit that referenced this issue Aug 27, 2021
@lervag
Copy link
Owner

lervag commented Aug 27, 2021

Thanks! You're right; the specified change did introduce a lag. On my end it is much less distinct, so I never noticed. I measured it to about 0.03s before and 0.17s after. I've now pushed an update that should improve this quite a lot. On my end, the delay is reduced from 0.17s to 0.07s, so still somewhat slower. Can you test and see if it is acceptable?

The lag is introduced by some code that uses xdotool to focus Vim after the backward search. I've now also improved the code so that it should work if you're working inside tmux.

But, if you really don't want this and you think the lag is still too high, then we can definitely consider to add an option here.

@lervag lervag closed this as completed Aug 27, 2021
@moetayuko
Copy link
Contributor Author

moetayuko commented Aug 28, 2021

Thanks for the update, the lag is much lower now, still noticeable but shouldn't break the workflow, completely acceptable to me.

As a bonus, the vim window automatically gets focused after a backward search and no longer need to be done manually, the overall UX is improved a lot.

@lervag
Copy link
Owner

lervag commented Aug 28, 2021

Great, I'm glad to hear it!

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