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

Re: [PATCH] new ex command :lscscope

Expand Messages
  • Navdeep Parhar
    Hello, ... The location list of the current window is not modified by :lsc . Only the list of the new window (opened as a result of the split) is affected.
    Message 1 of 8 , Apr 29 8:06 PM
      Hello,

      --- Yegappan Lakshmanan <yegappanl@...> wrote:
      > Hi,
      >
      > On 4/28/07, Navdeep Parhar <nsparhar@...> wrote:
      > > >
      > > > > > > Hello,
      > > > > > >
      > > > > > > Currently :cscope has a variant :lcscope that allows the use of
      > > > > > > the location list instead of the quickfix list. However, :scscope
      > > > > > > has no equivalent that uses the location list. Please note that
      > > > > > > :scs splits only if cscope returns some results, so :scs is not
      > > > > > > the same as ":split cs". Due to this reason ":split lcscope" can
      > > > > > > not be used to get the same behaviour as the proposed :lscscope.
      > > > > > >
      > > > >
      > > > > I'm confused. I tried exercising this patch and I'm not getting the
      > > > > results I expect, but I don't know if it's the patch, the behavior
      > > > > of location lists, or me.
      > > > >
      > > >
      > > > This problem is caused by the patch for the ":lscs" command.
      > > >
      > > > When the ":lcs" command is executed, a new location list is
      > > > created for the current window and then the cursor is moved to the
      > > > first entry in the location list.
      > > >
      > > > The ":lscs" command splits the window after the location list is
      > > > created. This results in the problem.
      > > >
      > > > In your case, when you executed the ":lscs" command in the
      > > > first window, the new location list is added to the first window
      > > > and then the window is split.
      > > >
      > > > When you invoked the second "lscs" command, a new location
      > > > list is added to the second window and then the window is split.
      > > >
      > >
      > > This is correct. The problem both times is that the split takes
      > > place after the error list has been constructed.
      > >
      > > I have reworked the patch a bit. Now it splits the window
      > > before constructing the error list. I'd like to point out
      > > that with this modification the behaviour if qf_init fails
      > > will be different from what it is today. The split will
      > > have taken place by the time qf_init gets called.
      > >
      >
      > This may not be desirable. This will break backwards
      > compatibility. When the ":lscscope" command fails, the
      > current window should not be split and also the location
      > list for the current window should not be modified.
      >

      The location list of the current window is not modified by
      ":lsc". Only the list of the new window (opened as a
      result of the split) is affected. So this leaves one
      issue - what to do if the current window has already been
      split and then there is a problem creating the error list.

      qf_init wants a valid wp in order to work with llist. This
      wp must be of the new window or else we'll modify the
      location list of the current window. wp of the new window
      can only be obtained once it exists. This appears to be
      a circular problem. Any suggestions to get around this?

      Is it acceptable to just close the newly opened window
      in case an error occurs after the split? Note that this
      may cause some "flicker" like effects where a window/tab
      is created and then disappears soon after.

      -Navdeep

      > - Yegappan
      >
      > >
      > > Other than this everything should mostly work as advertised.
      > >
      > >
      > > New patch is attached to this email.
      > >
      > > Regards,
      > > Navdeep
      > >
      > > > Also, when jumping to the match from the location list, the
      > > > location list for the window before the split is used. This results
      > > > in the second problem you saw after closing the windows.
      > > >
      > > > When the location list support was added to Vim7, as the ":lscscope"
      > > > command was not supported, this condition was not taken into
      > > > account.
      > > >
      > > > - Yegappan
      > > >
      > >
      >


      __________________________________________________
      Do You Yahoo!?
      Tired of spam? Yahoo! Mail has the best spam protection around
      http://mail.yahoo.com
    Your message has been successfully submitted and would be delivered to recipients shortly.