Hello, --- Yegappan Lakshmanan <[EMAIL PROTECTED]> wrote: > Hi Gary, > > On 4/27/07, Gary Johnson <[EMAIL PROTECTED]> wrote: > > On 2007-04-27, Gary Johnson <[EMAIL PROTECTED]> wrote: > > > On 2007-04-26, Navdeep Parhar <[EMAIL PROTECTED]> 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. 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
Index: runtime/doc/if_cscop.txt =================================================================== --- runtime/doc/if_cscop.txt (revision 252) +++ runtime/doc/if_cscop.txt (working copy) @@ -213,6 +213,11 @@ 'cscopequickfix' option is set, the location list for the current window is used instead of the quickfix list to show the cscope results. + *:lscscope* *:lsc* +This command is same as the ":scscope" command, except when the +'cscopequickfix' option is set, the location list for the current window is +used instead of the quickfix list to show the cscope results. + *:cstag* *E257* *E562* If you use cscope as well as ctags, |:cstag| allows you to search one or the other before making a jump. For example, you can choose to first Index: runtime/doc/index.txt =================================================================== --- runtime/doc/index.txt (revision 252) +++ runtime/doc/index.txt (working copy) @@ -1276,6 +1276,7 @@ |:lpfile| :lpf[ile] go to last location in previous file |:lrewind| :lr[ewind] go to the specified location, default first one |:ls| :ls list all buffers +|:lscscope| :lsc[scope] like ":scscope" but uses location list |:ltag| :lt[ag] jump to tag and add matching tags to the location list |:lunmap| :lu[nmap] like ":unmap!" but includes Lang-Arg mode Index: src/ex_cmds.h =================================================================== --- src/ex_cmds.h (revision 252) +++ src/ex_cmds.h (working copy) @@ -581,6 +581,8 @@ RANGE|NOTADR|COUNT|TRLBAR), EX(CMD_ls, "ls", buflist_list, BANG|TRLBAR|CMDWIN), +EX(CMD_lscscope, "lscscope", do_scscope, + EXTRA|NOTRLCOM|SBOXOK), EX(CMD_move, "move", ex_copymove, RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY), EX(CMD_mark, "mark", ex_mark, Index: src/if_cscope.c =================================================================== --- src/if_cscope.c (revision 252) +++ src/if_cscope.c (working copy) @@ -973,7 +973,7 @@ } return cs_find_common(opt, pat, eap->forceit, TRUE, - eap->cmdidx == CMD_lcscope); + eap->cmdidx == CMD_lcscope || eap->cmdidx == CMD_lscscope); } /* cs_find */ @@ -1115,23 +1115,23 @@ { cs_file_results(f, nummatches); fclose(f); +# ifdef FEAT_WINDOWS + if (postponed_split != 0) + { + win_split(postponed_split > 0 ? postponed_split : 0, + postponed_split_flags); +# ifdef FEAT_SCROLLBIND + curwin->w_p_scb = FALSE; +# endif + postponed_split = 0; + } +# endif if (use_ll) /* Use location list */ wp = curwin; /* '-' starts a new error list */ if (qf_init(wp, tmp, (char_u *)"%f%*\\t%l%*\\t%m", *qfpos == '-') > 0) { -# ifdef FEAT_WINDOWS - if (postponed_split != 0) - { - win_split(postponed_split > 0 ? postponed_split : 0, - postponed_split_flags); -# ifdef FEAT_SCROLLBIND - curwin->w_p_scb = FALSE; -# endif - postponed_split = 0; - } -# endif if (use_ll) /* * In the location list window, use the displayed location