diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/eval/funcs.c | 3 | ||||
| -rw-r--r-- | src/nvim/quickfix.c | 102 | ||||
| -rw-r--r-- | src/nvim/testdir/test_cd.vim | 20 | ||||
| -rw-r--r-- | src/nvim/testdir/test_quickfix.vim | 122 | ||||
| -rw-r--r-- | src/nvim/testdir/test_swap.vim | 4 | ||||
| -rw-r--r-- | src/nvim/testdir/test_tagjump.vim | 13 | ||||
| -rw-r--r-- | src/nvim/window.c | 1 | 
7 files changed, 225 insertions, 40 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index f4735b3751..21c858373c 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -11392,6 +11392,9 @@ static void f_win_gettype(typval_T *argvars, typval_T *rettv, FunPtr fptr)      rettv->vval.v_string = vim_strsave((char_u *)"popup");    } else if (wp == curwin && cmdwin_type != 0) {      rettv->vval.v_string = vim_strsave((char_u *)"command"); +  } else if (bt_quickfix(wp->w_buffer)) { +    rettv->vval.v_string = vim_strsave((char_u *)(wp->w_llist_ref != NULL ? +                                                  "loclist" : "quickfix"));    }  } diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 7c7b790d5c..0cfb7c192f 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -54,20 +54,23 @@ struct dir_stack_T {  // For each error the next struct is allocated and linked in a list.  typedef struct qfline_S qfline_T;  struct qfline_S { -  qfline_T    *qf_next;         ///< pointer to next error in the list -  qfline_T    *qf_prev;         ///< pointer to previous error in the list -  linenr_T qf_lnum;             ///< line number where the error occurred -  int qf_fnum;                  ///< file number for the line -  int qf_col;                   ///< column where the error occurred -  int qf_nr;                    ///< error number -  char_u      *qf_module;       ///< module name for this error -  char_u      *qf_pattern;      ///< search pattern for the error -  char_u      *qf_text;         ///< description of the error -  char_u qf_viscol;             ///< set to TRUE if qf_col is screen column -  char_u qf_cleared;            ///< set to TRUE if line has been deleted -  char_u qf_type;               ///< type of the error (mostly 'E'); 1 for -                                //   :helpgrep -  char_u qf_valid;              ///< valid error message detected +  qfline_T *qf_next;      ///< pointer to next error in the list +  qfline_T *qf_prev;      ///< pointer to previous error in the list +  linenr_T qf_lnum;       ///< line number where the error occurred +  linenr_T qf_end_lnum;   ///< line number when the error has range or zero + +  int qf_fnum;            ///< file number for the line +  int qf_col;             ///< column where the error occurred +  int qf_end_col;         ///< column when the error has range or zero +  int qf_nr;              ///< error number +  char_u *qf_module;      ///< module name for this error +  char_u *qf_pattern;     ///< search pattern for the error +  char_u *qf_text;        ///< description of the error +  char_u qf_viscol;       ///< set to TRUE if qf_col and qf_end_col is +                          //   screen column +  char_u qf_cleared;      ///< set to TRUE if line has been deleted +  char_u qf_type;         ///< type of the error (mostly 'E'); 1 for :helpgrep +  char_u qf_valid;        ///< valid error message detected  };  // There is a stack of error lists. @@ -197,7 +200,9 @@ typedef struct {    char_u *errmsg;    size_t errmsglen;    long lnum; +  long end_lnum;    int  col; +  int end_col;    bool use_viscol;    char_u *pattern;    int    enr; @@ -282,7 +287,9 @@ static int qf_init_process_nextline(qf_list_T *qfl,                        0,                        fields->errmsg,                        fields->lnum, +                      fields->end_lnum,                        fields->col, +                      fields->end_col,                        fields->use_viscol,                        fields->pattern,                        fields->enr, @@ -1561,7 +1568,9 @@ static int qf_parse_get_fields(char_u *linebuf, size_t linelen, efm_T *fmt_ptr,      fields->errmsg[0] = NUL;    }    fields->lnum = 0; +  fields->end_lnum = 0;    fields->col = 0; +  fields->end_col = 0;    fields->use_viscol = false;    fields->enr = -1;    fields->type = 0; @@ -1799,7 +1808,9 @@ void check_quickfix_busy(void)  /// @param  bufnum   buffer number or zero  /// @param  mesg     message  /// @param  lnum     line number +/// @param  end_lnum  line number for end  /// @param  col      column +/// @param  end_col  column for end  /// @param  vis_col  using visual column  /// @param  pattern  search pattern  /// @param  nr       error number @@ -1808,8 +1819,9 @@ void check_quickfix_busy(void)  ///  /// @returns QF_OK or QF_FAIL.  static int qf_add_entry(qf_list_T *qfl, char_u *dir, char_u *fname, -                        char_u *module, int bufnum, char_u *mesg, long lnum, -                        int col, char_u vis_col, char_u *pattern, int nr, +                        char_u *module, int bufnum, char_u *mesg, +                        long lnum, long end_lnum, int col, int end_col, +                        char_u vis_col, char_u *pattern, int nr,                          char_u type, char_u valid)  {    qfline_T *qfp = xmalloc(sizeof(qfline_T)); @@ -1828,7 +1840,9 @@ static int qf_add_entry(qf_list_T *qfl, char_u *dir, char_u *fname,    }    qfp->qf_text = vim_strsave(mesg);    qfp->qf_lnum = lnum; +  qfp->qf_end_lnum = end_lnum;    qfp->qf_col = col; +  qfp->qf_end_col = end_col;    qfp->qf_viscol = vis_col;    if (pattern == NULL || *pattern == NUL) {      qfp->qf_pattern = NULL; @@ -1957,7 +1971,9 @@ static int copy_loclist_entries(const qf_list_T *from_qfl, qf_list_T *to_qfl)                       0,                       from_qfp->qf_text,                       from_qfp->qf_lnum, +                     from_qfp->qf_end_lnum,                       from_qfp->qf_col, +                     from_qfp->qf_end_col,                       from_qfp->qf_viscol,                       from_qfp->qf_pattern,                       from_qfp->qf_nr, @@ -2998,6 +3014,7 @@ static void qf_jump_newwin(qf_info_T *qi, int dir, int errornr, int forceit,    }    qfl->qf_index = qf_index; +  qfl->qf_ptr = qf_ptr;    if (qf_win_pos_update(qi, old_qf_index)) {      // No need to print the error message if it's visible in the error      // window @@ -3108,11 +3125,8 @@ static void qf_list_entry(qfline_T *qfp, int qf_idx, bool cursel)    }    if (qfp->qf_lnum == 0) {      IObuff[0] = NUL; -  } else if (qfp->qf_col == 0) { -    vim_snprintf((char *)IObuff, IOSIZE, "%" PRIdLINENR, qfp->qf_lnum);    } else { -    vim_snprintf((char *)IObuff, IOSIZE, "%" PRIdLINENR " col %d", -                 qfp->qf_lnum, qfp->qf_col); +    qf_range_text(qfp, IObuff, IOSIZE);    }    vim_snprintf((char *)IObuff + STRLEN(IObuff), IOSIZE, "%s",                 (char *)qf_types(qfp->qf_type, qfp->qf_nr)); @@ -3232,6 +3246,32 @@ static void qf_fmt_text(const char_u *restrict text, char_u *restrict buf,    buf[i] = NUL;  } +// Range information from lnum, col, end_lnum, and end_col. +// Put the result in "buf[bufsize]". +static void qf_range_text(const qfline_T *qfp, char_u *buf, int bufsize) +{ +  vim_snprintf((char *)buf, (size_t)bufsize, "%" PRIdLINENR, qfp->qf_lnum); +  int len = (int)STRLEN(buf); + +  if (qfp->qf_end_lnum > 0 && qfp->qf_lnum != qfp->qf_end_lnum) { +    vim_snprintf((char *)buf + len, (size_t)(bufsize - len), +                 "-%" PRIdLINENR, qfp->qf_end_lnum); +    len += (int)STRLEN(buf + len); +  } +  if (qfp->qf_col > 0) { +    vim_snprintf((char *)buf + len, (size_t)(bufsize - len), +                 " col %d", qfp->qf_col); +    len += (int)STRLEN(buf + len); +    if (qfp->qf_end_col > 0 && qfp->qf_col != qfp->qf_end_col) { +      vim_snprintf((char *)buf + len, (size_t)(bufsize - len), +                   "-%d", qfp->qf_end_col); +      len += (int)STRLEN(buf + len); +    } +  } +  buf[len] = NUL; +} + +  /// Display information (list number, list size and the title) about a  /// quickfix/location list.  static void qf_msg(qf_info_T *qi, int which, char *lead) @@ -4005,16 +4045,9 @@ static int qf_buf_add_line(qf_list_T *qfl, buf_T *buf, linenr_T lnum,        IObuff[len++] = '|';      }      if (qfp->qf_lnum > 0) { -      snprintf((char *)IObuff + len, (size_t)(IOSIZE - len), "%" PRId64, -               (int64_t)qfp->qf_lnum); +      qf_range_text(qfp, IObuff + len, IOSIZE - len);        len += (int)STRLEN(IObuff + len); -      if (qfp->qf_col > 0) { -        snprintf((char *)IObuff + len, (size_t)(IOSIZE - len), " col %d", -                 qfp->qf_col); -        len += (int)STRLEN(IObuff + len); -      } -        snprintf((char *)IObuff + len, (size_t)(IOSIZE - len), "%s",                 (char *)qf_types(qfp->qf_type, qfp->qf_nr));        len += (int)STRLEN(IObuff + len); @@ -5263,7 +5296,9 @@ static bool vgr_match_buflines(qf_list_T *qfl, char_u *fname, buf_T *buf,                         ml_get_buf(buf, regmatch->startpos[0].lnum + lnum,                                    false),                         regmatch->startpos[0].lnum + lnum, +                       regmatch->endpos[0].lnum + lnum,                         regmatch->startpos[0].col + 1, +                       regmatch->endpos[0].col + 1,                         false,  // vis_col                         NULL,   // search pattern                         0,      // nr @@ -5765,7 +5800,11 @@ static int get_qfline_items(qfline_T *qfp, list_T *list)    if (tv_dict_add_nr(dict, S_LEN("bufnr"), (varnumber_T)bufnum) == FAIL        || (tv_dict_add_nr(dict, S_LEN("lnum"), (varnumber_T)qfp->qf_lnum)            == FAIL) +      || (tv_dict_add_nr(dict, S_LEN("end_lnum"), (varnumber_T)qfp->qf_end_lnum) +          == FAIL)        || (tv_dict_add_nr(dict, S_LEN("col"), (varnumber_T)qfp->qf_col) == FAIL) +      || (tv_dict_add_nr(dict, S_LEN("end_col"), (varnumber_T)qfp->qf_end_col) +          == FAIL)        || (tv_dict_add_nr(dict, S_LEN("vcol"), (varnumber_T)qfp->qf_viscol)            == FAIL)        || (tv_dict_add_nr(dict, S_LEN("nr"), (varnumber_T)qfp->qf_nr) == FAIL) @@ -6263,7 +6302,9 @@ static int qf_add_entry_from_dict(    char *const module = tv_dict_get_string(d, "module", true);    int bufnum = (int)tv_dict_get_number(d, "bufnr");    const long lnum = (long)tv_dict_get_number(d, "lnum"); +  const long end_lnum = (long)tv_dict_get_number(d, "end_lnum");    const int col = (int)tv_dict_get_number(d, "col"); +  const int end_col = (int)tv_dict_get_number(d, "end_col");    const char_u vcol = (char_u)tv_dict_get_number(d, "vcol");    const int nr = (int)tv_dict_get_number(d, "nr");    const char *const type = tv_dict_get_string(d, "type", false); @@ -6301,7 +6342,9 @@ static int qf_add_entry_from_dict(                                    bufnum,                                    (char_u *)text,                                    lnum, +                                  end_lnum,                                    col, +                                  end_col,                                    vcol,      // vis_col                                    (char_u *)pattern,   // search pattern                                    nr, @@ -7035,7 +7078,10 @@ static void hgr_search_file(                         0,                         line,                         lnum, +                       0,                         (int)(p_regmatch->startp[0] - line) + 1,  // col +                       (int)(p_regmatch->endp[0] - line) +                       + 1,    // end_col                         false,  // vis_col                         NULL,   // search pattern                         0,      // nr diff --git a/src/nvim/testdir/test_cd.vim b/src/nvim/testdir/test_cd.vim index 770ed55b8d..02a23bf82f 100644 --- a/src/nvim/testdir/test_cd.vim +++ b/src/nvim/testdir/test_cd.vim @@ -1,4 +1,7 @@ -" Test for :cd +" Test for :cd and chdir() + +source shared.vim +source check.vim  func Test_cd_large_path()    " This used to crash with a heap write overflow. @@ -65,3 +68,18 @@ func Test_cd_with_cpo_chdir()    set cpo&    bw!  endfunc + +func Test_cd_from_non_existing_dir() +  CheckNotMSWindows + +  let saveddir = getcwd() +  call mkdir('Xdeleted_dir') +  cd Xdeleted_dir +  call delete(saveddir .. '/Xdeleted_dir', 'd') + +  " Expect E187 as the current directory was deleted. +  call assert_fails('pwd', 'E187:') +  call assert_equal('', getcwd()) +  cd - +  call assert_equal(saveddir, getcwd()) +endfunc diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index c0b9dd7696..5090584e41 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -134,6 +134,21 @@ func XlistTests(cchar)    call assert_equal([' 2 Xtestfile1:1 col 3: Line1',  		   \ ' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2'], l) +  " Ranged entries +  call g:Xsetlist([{'lnum':10,'text':'Line1'}, +	      \ {'lnum':20,'col':10,'text':'Line2'}, +	      \ {'lnum':30,'col':15,'end_col':20,'text':'Line3'}, +	      \ {'lnum':40,'end_lnum':45,'text':'Line4'}, +	      \ {'lnum':50,'end_lnum':55,'col':15,'text':'Line5'}, +	      \ {'lnum':60,'end_lnum':65,'col':25,'end_col':35,'text':'Line6'}]) +  let l = split(execute('Xlist', ""), "\n") +  call assert_equal([' 1:10: Line1', +	      \ ' 2:20 col 10: Line2', +	      \ ' 3:30 col 15-20: Line3', +	      \ ' 4:40-45: Line4', +	      \ ' 5:50-55 col 15: Line5', +	      \ ' 6:60-65 col 25-35: Line6'], l) +    " Different types of errors    call g:Xsetlist([{'lnum':10,'col':5,'type':'W', 'text':'Warning','nr':11},  	      \ {'lnum':20,'col':10,'type':'e','text':'Error','nr':22}, @@ -599,6 +614,7 @@ func s:test_xhelpgrep(cchar)    call assert_true(&buftype == 'help')    call assert_true(winnr() == 1)    call assert_true(winnr('$') == 2) +  call assert_match('|\d\+ col \d\+-\d\+|', getbufline(winbufnr(2), 1)[0])    " This wipes out the buffer, make sure that doesn't cause trouble.    Xclose @@ -1437,10 +1453,13 @@ func SetXlistTests(cchar, bnum)    call s:setup_commands(a:cchar)    call g:Xsetlist([{'bufnr': a:bnum, 'lnum': 1}, -	      \  {'bufnr': a:bnum, 'lnum': 2}]) +	      \  {'bufnr': a:bnum, 'lnum': 2, 'end_lnum': 3, 'col': 4, 'end_col': 5}])    let l = g:Xgetlist()    call assert_equal(2, len(l))    call assert_equal(2, l[1].lnum) +  call assert_equal(3, l[1].end_lnum) +  call assert_equal(4, l[1].col) +  call assert_equal(5, l[1].end_col)    Xnext    call g:Xsetlist([{'bufnr': a:bnum, 'lnum': 3}], 'a') @@ -2743,7 +2762,9 @@ func XvimgrepTests(cchar)    let l = g:Xgetlist()    call assert_equal(2, len(l))    call assert_equal(8, l[0].col) +  call assert_equal(11, l[0].end_col)    call assert_equal(12, l[1].col) +  call assert_equal(15, l[1].end_col)    1Xvimgrep ?Editor? Xtestfile*    let l = g:Xgetlist() @@ -4850,7 +4871,42 @@ func Test_add_invalid_entry_with_qf_window()    call setqflist(['bb'], 'a')    call assert_equal(1, line('$'))    call assert_equal(['Xfile1|10| aa'], getline(1, '$')) -  call assert_equal([{'lnum': 10, 'bufnr': bufnr('Xfile1'), 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'aa'}], getqflist()) +  call assert_equal([{'lnum': 10                    , 'end_lnum': 0    , 'bufnr': bufnr('Xfile1') , 'col': 0   , 'end_col': 0    , 'pattern': '' , 'valid': 1 , 'vcol': 0 , 'nr': -1 , 'type': '' , 'module': '' , 'text': 'aa'}] , getqflist()) + +  call setqflist([{'lnum': 10                                          , 'bufnr': bufnr('Xfile1') , 'col': 0                     , 'pattern': '' , 'valid': 1 , 'vcol': 0 , 'nr': -1 , 'type': '' , 'module': '' , 'text': 'aa'}] , 'r') +  call assert_equal(1                               , line('$')) +  call assert_equal(['Xfile1|10| aa']               , getline(1        , '$')) +  call assert_equal([{'lnum': 10                    , 'end_lnum': 0    , 'bufnr': bufnr('Xfile1') , 'col': 0   , 'end_col': 0    , 'pattern': '' , 'valid': 1 , 'vcol': 0 , 'nr': -1 , 'type': '' , 'module': '' , 'text': 'aa'}] , getqflist()) + +  call setqflist([{'lnum': 10                       , 'end_lnum': 0    , 'bufnr': bufnr('Xfile1') , 'col': 0   , 'end_col': 0    , 'pattern': '' , 'valid': 1 , 'vcol': 0 , 'nr': -1 , 'type': '' , 'module': '' , 'text': 'aa'}] , 'r') +  call assert_equal(1                               , line('$')) +  call assert_equal(['Xfile1|10| aa']               , getline(1        , '$')) +  call assert_equal([{'lnum': 10                    , 'end_lnum': 0    , 'bufnr': bufnr('Xfile1') , 'col': 0   , 'end_col': 0    , 'pattern': '' , 'valid': 1 , 'vcol': 0 , 'nr': -1 , 'type': '' , 'module': '' , 'text': 'aa'}] , getqflist()) + +  call setqflist([{'lnum': 10                       , 'end_lnum': -123 , 'bufnr': bufnr('Xfile1') , 'col': 0   , 'end_col': -456 , 'pattern': '' , 'valid': 1 , 'vcol': 0 , 'nr': -1 , 'type': '' , 'module': '' , 'text': 'aa'}] , 'r') +  call assert_equal(1                               , line('$')) +  call assert_equal(['Xfile1|10| aa']               , getline(1        , '$')) +  call assert_equal([{'lnum': 10                    , 'end_lnum': -123 , 'bufnr': bufnr('Xfile1') , 'col': 0   , 'end_col': -456 , 'pattern': '' , 'valid': 1 , 'vcol': 0 , 'nr': -1 , 'type': '' , 'module': '' , 'text': 'aa'}] , getqflist()) + +  call setqflist([{'lnum': 10                       , 'end_lnum': -123 , 'bufnr': bufnr('Xfile1') , 'col': 666 , 'end_col': 0    , 'pattern': '' , 'valid': 1 , 'vcol': 0 , 'nr': -1 , 'type': '' , 'module': '' , 'text': 'aa'}] , 'r') +  call assert_equal(1                               , line('$')) +  call assert_equal(['Xfile1|10 col 666| aa']       , getline(1        , '$')) +  call assert_equal([{'lnum': 10                    , 'end_lnum': -123 , 'bufnr': bufnr('Xfile1') , 'col': 666 , 'end_col': 0    , 'pattern': '' , 'valid': 1 , 'vcol': 0 , 'nr': -1 , 'type': '' , 'module': '' , 'text': 'aa'}] , getqflist()) + +  call setqflist([{'lnum': 10                       , 'end_lnum': -123 , 'bufnr': bufnr('Xfile1') , 'col': 666 , 'end_col': -456 , 'pattern': '' , 'valid': 1 , 'vcol': 0 , 'nr': -1 , 'type': '' , 'module': '' , 'text': 'aa'}] , 'r') +  call assert_equal(1                               , line('$')) +  call assert_equal(['Xfile1|10 col 666| aa']       , getline(1        , '$')) +  call assert_equal([{'lnum': 10                    , 'end_lnum': -123 , 'bufnr': bufnr('Xfile1') , 'col': 666 , 'end_col': -456 , 'pattern': '' , 'valid': 1 , 'vcol': 0 , 'nr': -1 , 'type': '' , 'module': '' , 'text': 'aa'}] , getqflist()) + +  call setqflist([{'lnum': 10                       , 'end_lnum': -123 , 'bufnr': bufnr('Xfile1') , 'col': 666 , 'end_col': 222  , 'pattern': '' , 'valid': 1 , 'vcol': 0 , 'nr': -1 , 'type': '' , 'module': '' , 'text': 'aa'}] , 'r') +  call assert_equal(1                               , line('$')) +  call assert_equal(['Xfile1|10 col 666-222| aa']   , getline(1        , '$')) +  call assert_equal([{'lnum': 10                    , 'end_lnum': -123 , 'bufnr': bufnr('Xfile1') , 'col': 666 , 'end_col': 222  , 'pattern': '' , 'valid': 1 , 'vcol': 0 , 'nr': -1 , 'type': '' , 'module': '' , 'text': 'aa'}] , getqflist()) + +  call setqflist([{'lnum': 10                       , 'end_lnum': 6 , 'bufnr': bufnr('Xfile1') , 'col': 666 , 'end_col': 222  , 'pattern': '' , 'valid': 1 , 'vcol': 0 , 'nr': -1 , 'type': '' , 'module': '' , 'text': 'aa'}] , 'r') +  call assert_equal(1                               , line('$')) +  call assert_equal(['Xfile1|10-6 col 666-222| aa'] , getline(1        , '$')) +  call assert_equal([{'lnum': 10                    , 'end_lnum': 6 , 'bufnr': bufnr('Xfile1') , 'col': 666 , 'end_col': 222  , 'pattern': '' , 'valid': 1 , 'vcol': 0 , 'nr': -1 , 'type': '' , 'module': '' , 'text': 'aa'}] , getqflist())    cclose  endfunc @@ -5001,15 +5057,21 @@ func Xtest_qftextfunc(cchar)    call assert_equal('Tqfexpr', &quickfixtextfunc)    call assert_equal('',          \ g:Xgetlist({'quickfixtextfunc' : 1}).quickfixtextfunc) -  Xexpr ['F1:10:2:green', 'F1:20:4:blue'] +  call g:Xsetlist([ +        \ { 'filename': 'F1', 'lnum': 10, 'col': 2, +        \   'end_col': 7, 'text': 'green'}, +        \ { 'filename': 'F1', 'lnum': 20, 'end_lnum': 25, 'col': 4, +        \   'end_col': 8, 'text': 'blue'}, +        \ ]) +    Xwindow    call assert_equal('F1-L10C2-green', getline(1))    call assert_equal('F1-L20C4-blue', getline(2))    Xclose    set quickfixtextfunc&vim    Xwindow -  call assert_equal('F1|10 col 2| green', getline(1)) -  call assert_equal('F1|20 col 4| blue', getline(2)) +  call assert_equal('F1|10 col 2-7| green', getline(1)) +  call assert_equal('F1|20-25 col 4-8| blue', getline(2))    Xclose    set efm&    set quickfixtextfunc& @@ -5196,4 +5258,54 @@ func Test_qftextfunc_other_loclist()    %bw!  endfunc +func Test_locationlist_open_in_newtab() +  call s:create_test_file('Xqftestfile1') +  call s:create_test_file('Xqftestfile2') +  call s:create_test_file('Xqftestfile3') + +  %bwipe! + +  lgetexpr ['Xqftestfile1:5:Line5', +		\ 'Xqftestfile2:10:Line10', +		\ 'Xqftestfile3:16:Line16'] + +  silent! llast +  call assert_equal(1, tabpagenr('$')) +  call assert_equal('Xqftestfile3', bufname()) + +  set switchbuf=newtab + +  silent! lfirst +  call assert_equal(2, tabpagenr('$')) +  call assert_equal('Xqftestfile1', bufname()) + +  silent! lnext +  call assert_equal(3, tabpagenr('$')) +  call assert_equal('Xqftestfile2', bufname()) + +  call delete('Xqftestfile1') +  call delete('Xqftestfile2') +  call delete('Xqftestfile3') +  set switchbuf&vim + +  %bwipe! +endfunc + +" Test for win_gettype() in quickfix and location list windows +func Test_win_gettype() +  copen +  call assert_equal("quickfix", win_gettype()) +  let wid = win_getid() +  wincmd p +  call assert_equal("quickfix", win_gettype(wid)) +  cclose +  lexpr '' +  lopen +  call assert_equal("loclist", win_gettype()) +  let wid = win_getid() +  wincmd p +  call assert_equal("loclist", win_gettype(wid)) +  lclose +endfunc +  " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_swap.vim b/src/nvim/testdir/test_swap.vim index 3c191cd7c7..02bc297de1 100644 --- a/src/nvim/testdir/test_swap.vim +++ b/src/nvim/testdir/test_swap.vim @@ -376,4 +376,8 @@ func Test_swap_symlink()    call delete('Xswapdir', 'rf')  endfunc +func Test_no_swap_file() +  call assert_equal("\nNo swap file", execute('swapname')) +endfunc +  " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_tagjump.vim b/src/nvim/testdir/test_tagjump.vim index 9f02af7d8e..68dcfb6890 100644 --- a/src/nvim/testdir/test_tagjump.vim +++ b/src/nvim/testdir/test_tagjump.vim @@ -771,15 +771,16 @@ func Test_ltag()    ltag third    call assert_equal('Xfoo', bufname(''))    call assert_equal(3, line('.')) -  call assert_equal([{'lnum': 3, 'bufnr': bufnr('Xfoo'), 'col': 0, -        \ 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': 0, 'type': '', -        \ 'module': '', 'text': 'third'}], getloclist(0)) +  call assert_equal([{'lnum': 3, 'end_lnum': 0, 'bufnr': bufnr('Xfoo'), +        \ 'col': 0, 'end_col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, +        \ 'nr': 0, 'type': '', 'module': '', 'text': 'third'}], getloclist(0))    ltag second    call assert_equal(2, line('.')) -  call assert_equal([{'lnum': 0, 'bufnr': bufnr('Xfoo'), 'col': 0, -        \ 'pattern': '^\Vint second() {}\$', 'valid': 1, 'vcol': 0, 'nr': 0, -        \ 'type': '', 'module': '', 'text': 'second'}], getloclist(0)) +  call assert_equal([{'lnum': 0, 'end_lnum': 0, 'bufnr': bufnr('Xfoo'), +        \ 'col': 0, 'end_col': 0, 'pattern': '^\Vint second() {}\$', +        \ 'valid': 1, 'vcol': 0, 'nr': 0, 'type': '', 'module': '', +        \ 'text': 'second'}], getloclist(0))    call delete('Xtags')    call delete('Xfoo') diff --git a/src/nvim/window.c b/src/nvim/window.c index fb1a4a580b..0856e75758 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -4662,6 +4662,7 @@ win_free (          // If there already is an entry with "wi_win" set to NULL it          // must be removed, it would never be used. +        // Skip "wip" itself, otherwise Coverity complains.          for (wip2 = buf->b_wininfo; wip2 != NULL; wip2 = wip2->wi_next) {            // `wip2 != wip` to satisfy Coverity. #14884            if (wip2 != wip && wip2->wi_win == NULL) {  | 
