Loading ...
Sorry, an error occurred while loading the content.
 

[patch] Quickfix: incorrect entry highlighted, unexpectedly new windows opened

Expand Messages
  • Lech Lorens
    I have been suffering from two problems with the quickfix functionality. The first one is a bug, the second one I would call a usability issue. 1st problem: -
    Message 1 of 2 , Jun 29, 2013
      I have been suffering from two problems with the quickfix functionality.
      The first one is a bug, the second one I would call a usability issue.

      1st problem:
      - I have a location list with entries relating each to a different file:
      foo.txt, bar.txt, baz.txt, quux.txt, etc.
      - it is possible to get a situation where foo.txt is opened while the
      location list will highlight baz.txt,
      - when I execute ":lnext", bar.txt is opened but the highlighting in the
      location list will move to quux.txt


      2nd problem:
      - I have a window with a loaded buffer, this window has its location
      list window opened,
      - I move to the location list window, move to an entry corresponding to
      another buffer, press enter and the new buffer will open in a new
      window instead of reusing the one to which the location list is
      corresponding,
      - each of the entries in the location list corresponding to to different
      buffers will have its own new window opened.

      I have a problem with this approach. While normally using ":lnext" is
      the equivalent of entering the location list window, moving the cursor
      to the next line and pressing enter, in this case the behaviour is
      different. What is enough to make this happen is for the buffers to have
      their 'bt' set.
      My proposed change here is to always try to reuse the window to which
      the location list window corresponds and only if it is impossible, to
      find another window or to open a new one.

      Find attached:
      - quickfix1.patch – fixes the 1st problem,
      - quickfix2.patch – fixes the 2nd problem,
      - problem1.vim – source it to reproduce the 1st problem,
      - problem2.vim – source it to reproduce the 2nd problem,
      - base.vim – used by problem1.vim and problem2.vim to set up the
      location list and loading buffer contents.

      I will prepare test for quickfix1.patch ASAP.

      Before I prepare test for quickfix2.patch I would know if the change
      will be accepted – I don't want to spend my time on something that will
      never be used.

      --
      Lech Lorens

      --
      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Bram Moolenaar
      ... Clearly the first problem is a bug. I ll include that fix. The second problem makes sense. I don t know why you have buftype set for a window that
      Message 2 of 2 , Jun 30, 2013
        Lech Lorens wrote:

        > I have been suffering from two problems with the quickfix functionality.
        > The first one is a bug, the second one I would call a usability issue.
        >
        > 1st problem:
        > - I have a location list with entries relating each to a different file:
        > foo.txt, bar.txt, baz.txt, quux.txt, etc.
        > - it is possible to get a situation where foo.txt is opened while the
        > location list will highlight baz.txt,
        > - when I execute ":lnext", bar.txt is opened but the highlighting in the
        > location list will move to quux.txt
        >
        >
        > 2nd problem:
        > - I have a window with a loaded buffer, this window has its location
        > list window opened,
        > - I move to the location list window, move to an entry corresponding to
        > another buffer, press enter and the new buffer will open in a new
        > window instead of reusing the one to which the location list is
        > corresponding,
        > - each of the entries in the location list corresponding to to different
        > buffers will have its own new window opened.
        >
        > I have a problem with this approach. While normally using ":lnext" is
        > the equivalent of entering the location list window, moving the cursor
        > to the next line and pressing enter, in this case the behaviour is
        > different. What is enough to make this happen is for the buffers to have
        > their 'bt' set.
        > My proposed change here is to always try to reuse the window to which
        > the location list window corresponds and only if it is impossible, to
        > find another window or to open a new one.
        >
        > Find attached:
        > - quickfix1.patch – fixes the 1st problem,
        > - quickfix2.patch – fixes the 2nd problem,
        > - problem1.vim – source it to reproduce the 1st problem,
        > - problem2.vim – source it to reproduce the 2nd problem,
        > - base.vim – used by problem1.vim and problem2.vim to set up the
        > location list and loading buffer contents.
        >
        > I will prepare test for quickfix1.patch ASAP.
        >
        > Before I prepare test for quickfix2.patch I would know if the change
        > will be accepted – I don't want to spend my time on something that will
        > never be used.

        Clearly the first problem is a bug. I'll include that fix.

        The second problem makes sense. I don't know why you have 'buftype' set
        for a window that shows a file with a location. But it's defenitely
        better to use a window related to the location list.

        I think we do need an additional check that we don't pick the location
        window itself, thus 'buftype' can't be "quickfix".

        I'll include the patch, please check for any mistakes. And if you can
        write a test that would be great.


        --
        The question is: What do you do with your life?
        The wrong answer is: Become the richest guy in the graveyard.
        (billionaire and Oracle founder Larry Ellison)

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ an exciting new programming language -- http://www.Zimbu.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

        --
        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      Your message has been successfully submitted and would be delivered to recipients shortly.