vim-dispatch icon indicating copy to clipboard operation
vim-dispatch copied to clipboard

Window sometimes doesn't jump to error unless focused

Open augustjanse opened this issue 6 years ago • 10 comments

When I type :Dispatch, :Dispatch make is opened in a small split. It prints the output as expected, but then jumps to the top. Only when I focus on this small split does it jump to the properly highlighted error.

Sometimes it does jump to the highlighted error without focusing. The first time I run :Dispatch in a new session, it always does this.

I'm running Vim in the Git Bash window on Windows.

augustjanse avatar Aug 16 '19 09:08 augustjanse

What if you press <C-L> to force a redraw without focusing the window? Does that fix the positioning?

tpope avatar Aug 17 '19 06:08 tpope

Nope, it had no effect. :redraw! didn't do anything either.

(For unrelated reasons, I switched to Vim in MSYS2 before trying, but it's exhibiting the same behavior.)

augustjanse avatar Aug 19 '19 11:08 augustjanse

Try with a slow script and see if that illuminates when and how it fails. Something like:

for i in $(seq 1 20); do
  sleep 1
  echo $i
done

tpope avatar Aug 19 '19 11:08 tpope

Not sure I understand what you want me to do. It printed the output and then jumped to the top as I would expect.

augustjanse avatar Aug 19 '19 11:08 augustjanse

This is the correct behavior. What happens if you take out the sleep?

tpope avatar Aug 19 '19 12:08 tpope

It blinks empty before drawing 1-10 at once (same end result as previous screenshot).

augustjanse avatar Aug 19 '19 12:08 augustjanse

I guess I don't understand what you mean by "doesn't jump to error". What are your definitions of "error" and "jump to"?

tpope avatar Aug 19 '19 12:08 tpope

Sorry, maybe I should have started with a screenshot.

When I run my tests (:Dispatch), I would like the error to be highlighted and scrolled down to in the quickfix window (not the code itself). This happens the first time:

On subsequent runs, however, it scrolls to the top instead:

Only when I focus on the quickfix window, it scrolls down to the highlighted error (identical to the first screenshot).

So, "error" is whatever Vim/Make determines is an error and "jump to" means scrolling down to and showing a line.

augustjanse avatar Aug 20 '19 08:08 augustjanse

Does closing the window with :cclose before running have any effect?

tpope avatar Aug 20 '19 12:08 tpope

No, it still did the second thing.

augustjanse avatar Aug 20 '19 12:08 augustjanse