To: vim_dev@googlegroups.com Subject: Patch 7.4.2264 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2264 Problem: When adding entries to an empty quickfix list the title is reset. Solution: Improve handling of the title. (Yegappan Lakshmanan) Files: src/testdir/test_quickfix.vim, src/quickfix.c *** ../vim-7.4.2263/src/testdir/test_quickfix.vim 2016-08-12 16:29:03.347068413 +0200 --- src/testdir/test_quickfix.vim 2016-08-27 13:27:22.496220621 +0200 *************** *** 1527,1532 **** --- 1527,1542 ---- call assert_equal('Sample', w:quickfix_title) Xclose + " Tests for action argument + silent! Xolder 999 + let qfnr = g:Xgetlist({'all':1}).nr + call g:Xsetlist([], 'r', {'title' : 'N1'}) + call assert_equal('N1', g:Xgetlist({'all':1}).title) + call g:Xsetlist([], ' ', {'title' : 'N2'}) + call assert_equal(qfnr + 1, g:Xgetlist({'all':1}).nr) + call g:Xsetlist([], ' ', {'title' : 'N3'}) + call assert_equal('N2', g:Xgetlist({'nr':2, 'title':1}).title) + " Invalid arguments call assert_fails('call g:Xgetlist([])', 'E715') call assert_fails('call g:Xsetlist([], "a", [])', 'E715') *** ../vim-7.4.2263/src/quickfix.c 2016-08-21 22:39:30.991567181 +0200 --- src/quickfix.c 2016-08-27 13:28:51.287455753 +0200 *************** *** 4753,4763 **** } static int ! qf_set_properties(qf_info_T *qi, dict_T *what) { dictitem_T *di; int retval = FAIL; int qf_idx; qf_idx = qi->qf_curlist; /* default is the current list */ if ((di = dict_find(what, (char_u *)"nr", -1)) != NULL) --- 4753,4767 ---- } static int ! qf_set_properties(qf_info_T *qi, dict_T *what, int action) { dictitem_T *di; int retval = FAIL; int qf_idx; + int newlist = FALSE; + + if (action == ' ' || qi->qf_curlist == qi->qf_listcount) + newlist = TRUE; qf_idx = qi->qf_curlist; /* default is the current list */ if ((di = dict_find(what, (char_u *)"nr", -1)) != NULL) *************** *** 4771,4776 **** --- 4775,4787 ---- } else return FAIL; + newlist = FALSE; /* use the specified list */ + } + + if (newlist) + { + qf_new_list(qi, NULL); + qf_idx = qi->qf_curlist; } if ((di = dict_find(what, (char_u *)"title", -1)) != NULL) *************** *** 4813,4819 **** } if (what != NULL) ! retval = qf_set_properties(qi, what); else retval = qf_add_entries(qi, list, title, action); --- 4824,4830 ---- } if (what != NULL) ! retval = qf_set_properties(qi, what, action); else retval = qf_add_entries(qi, list, title, action); *** ../vim-7.4.2263/src/version.c 2016-08-26 22:29:06.083185153 +0200 --- src/version.c 2016-08-27 13:35:09.100203933 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2264, /**/ -- From "know your smileys": :q vi user saying, "How do I get out of this damn emacs editor?" /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///