Skip to content

Window sometimes doesn't jump to error unless focused #284

Open

Description

@augustjanse

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.

Activity

  1. tpope commented on Aug 17, 2019

    @tpope
    Owner

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

  2. augustjanse commented on Aug 19, 2019

    @augustjanse
    Author

    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.)

  3. tpope commented on Aug 19, 2019

    @tpope
    Owner

    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
  4. augustjanse commented on Aug 19, 2019

    @augustjanse
    Author

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

  5. tpope commented on Aug 19, 2019

    @tpope
    Owner

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

  6. augustjanse commented on Aug 19, 2019

    @augustjanse
    Author

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

  7. tpope commented on Aug 19, 2019

    @tpope
    Owner

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

  8. augustjanse commented on Aug 20, 2019

    @augustjanse
    Author

    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.

  9. tpope commented on Aug 20, 2019

    @tpope
    Owner

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

  10. augustjanse commented on Aug 20, 2019

    @augustjanse
    Author

    No, it still did the second thing.

  11. symbolix commented on Jul 28, 2025

    @symbolix

    I'm having a potentially similar issue:

    When I run this:
    :Dispatch gcc %:p -o build/%:t:r

    I get the errors listed in the QF buffer,

     1 || /home/me/dev/vixrc-project-config/template_dispatch_typeA/src/main.c:20:5: warning: implicit declaration of function ‘my_request’ [-Wimplicit-function-declaration]¬
     2 ||    20 |     my_request(1);¬
     3 ||       |     ^~~~~~~~~~¬
     4 || /home/me/dev/vixrc-project-config/template_dispatch_typeA/src/main.c:22:36: error: expected ‘;’ before ‘sleep’¬
     5 ||    22 |     printf("Processing data ...\n")¬
     6 ||       |                                    ^¬
     7 ||       |                                    ;¬
     8 ||    23 |     sleep(5);¬
    

    But then none of the commands are working :cnext, :cprev etc. I can't jump to the errors based on the error message in the QF buffer.

    Upon further inspection using the following command:
    :echo getqflist()

    I can see that the QF is not constructed in the correct way, no filename or other information is present (line numbers etc.)

    [{'lnum': 0, 'bufnr': 0, 'end_lnum': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'I', 'end_col': 0, 'col': 0, 'text': '/home/me/dev/vixrc-project-config/template_dispatch_typeA/src/main.c: In function ‘main’:'}, {'lnum': 0, 'bufnr': 0, 'end_lnum': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'I', 'end_col': 0, 'col': 0, 'text': '/home/me/dev/vixrc-project-config/template_dispatch_typeA/src/main.c:20:5: warning: implicit declaration of function ‘my_request’ [-Wimplicit-function-declaration]'}, {'lnum': 0, 'bufnr': 0, 'end_lnum': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'I', 'end_col': 0, 'col': 0, 'text': '   20
    |     my_request(1);'}, {'lnum': 0, 'bufnr': 0, 'end_lnum': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'I', 'end_col': 0, 'col': 0, 'text': '      |     ^~~~~~~~~~'}, {'lnum': 0, 'bufnr': 0, 'end_lnum': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'I', 'end_col': 0, 'col': 0, 'text': '/home/me/dev/vixrc-project-config/template_dispatch_typeA/src/main.c:22:36: error: expected ‘;’ before ‘sleep’'}, {'lnum': 0, 'bufnr': 0, 'end_lnum': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'I', 'end_col': 0, 'col': 0, 'text': '   22 |     printf("Processing data ...\n")'}, {'lnum': 0, 'bufnr': 0, 'end_lnum': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'I', 'end_col': 0, 'col': 0, 'text': '      |                                    ^'}, {'lnum': 0, 'bufnr': 0, 'end_lnum': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'I', 'end_col': 0, 'col': 0, 'text': '      |                                    ;'}, {'lnum': 0, 'bufnr': 0, 'end_lnum': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'I', 'end_col': 0, 'col': 0, 'text': '   23 |     sleep(5);'}, {'lnum': 0, 'bufnr': 0, 'end_lnum': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'I', 'end_col': 0, 'col': 0, 'text': '      |     ~~~~~                           '}]
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions