Skip to content

Commit f62065e

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 75baa49 + 8d8aa0a commit f62065e

7 files changed

Lines changed: 97 additions & 18 deletions

File tree

src/channel.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,7 @@ channel_write_new_lines(buf_T *buf)
14501450

14511451
/*
14521452
* Invoke the "callback" on channel "channel".
1453+
* This does not redraw but sets channel_need_redraw;
14531454
*/
14541455
static void
14551456
invoke_callback(channel_T *channel, char_u *callback, partial_T *partial,
@@ -1464,8 +1465,7 @@ invoke_callback(channel_T *channel, char_u *callback, partial_T *partial,
14641465
call_func(callback, (int)STRLEN(callback),
14651466
&rettv, 2, argv, 0L, 0L, &dummy, TRUE, partial, NULL);
14661467
clear_tv(&rettv);
1467-
1468-
redraw_after_callback();
1468+
channel_need_redraw = TRUE;
14691469
}
14701470

14711471
/*
@@ -2028,6 +2028,10 @@ channel_exe_cmd(channel_T *channel, int part, typval_T *argv)
20282028
}
20292029
}
20302030

2031+
/*
2032+
* Invoke the callback at "cbhead".
2033+
* Does not redraw but sets channel_need_redraw.
2034+
*/
20312035
static void
20322036
invoke_one_time_callback(
20332037
channel_T *channel,
@@ -2118,6 +2122,7 @@ append_to_buffer(buf_T *buffer, char_u *msg, channel_T *channel)
21182122

21192123
/*
21202124
* Invoke a callback for "channel"/"part" if needed.
2125+
* This does not redraw but sets channel_need_redraw when redraw is needed.
21212126
* Return TRUE when a message was handled, there might be another one.
21222127
*/
21232128
static int
@@ -3487,13 +3492,10 @@ channel_parse_messages(void)
34873492
}
34883493
}
34893494

3490-
if (channel_need_redraw && must_redraw)
3495+
if (channel_need_redraw)
34913496
{
34923497
channel_need_redraw = FALSE;
3493-
update_screen(0);
3494-
setcursor();
3495-
cursor_on();
3496-
out_flush();
3498+
redraw_after_callback();
34973499
}
34983500

34993501
return ret;

src/quickfix.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static int qf_win_pos_update(qf_info_T *qi, int old_qf_index);
126126
static int is_qf_win(win_T *win, qf_info_T *qi);
127127
static win_T *qf_find_win(qf_info_T *qi);
128128
static buf_T *qf_find_buf(qf_info_T *qi);
129-
static void qf_update_buffer(qf_info_T *qi);
129+
static void qf_update_buffer(qf_info_T *qi, int update_cursor);
130130
static void qf_set_title_var(qf_info_T *qi);
131131
static void qf_fill_buffer(qf_info_T *qi);
132132
#endif
@@ -880,7 +880,7 @@ qf_init_ext(
880880
vim_free(fmtstr);
881881

882882
#ifdef FEAT_WINDOWS
883-
qf_update_buffer(qi);
883+
qf_update_buffer(qi, TRUE);
884884
#endif
885885

886886
return retval;
@@ -2176,7 +2176,7 @@ qf_msg(qf_info_T *qi)
21762176
qi->qf_curlist + 1, qi->qf_listcount,
21772177
qi->qf_lists[qi->qf_curlist].qf_count);
21782178
#ifdef FEAT_WINDOWS
2179-
qf_update_buffer(qi);
2179+
qf_update_buffer(qi, TRUE);
21802180
#endif
21812181
}
21822182

@@ -2606,7 +2606,7 @@ qf_find_buf(qf_info_T *qi)
26062606
* Find the quickfix buffer. If it exists, update the contents.
26072607
*/
26082608
static void
2609-
qf_update_buffer(qf_info_T *qi)
2609+
qf_update_buffer(qf_info_T *qi, int update_cursor)
26102610
{
26112611
buf_T *buf;
26122612
win_T *win;
@@ -2633,7 +2633,8 @@ qf_update_buffer(qf_info_T *qi)
26332633
/* restore curwin/curbuf and a few other things */
26342634
aucmd_restbuf(&aco);
26352635

2636-
(void)qf_win_pos_update(qi, 0);
2636+
if (update_cursor)
2637+
(void)qf_win_pos_update(qi, 0);
26372638
}
26382639
}
26392640

@@ -3675,7 +3676,7 @@ ex_vimgrep(exarg_T *eap)
36753676
qi->qf_lists[qi->qf_curlist].qf_index = 1;
36763677

36773678
#ifdef FEAT_WINDOWS
3678-
qf_update_buffer(qi);
3679+
qf_update_buffer(qi, TRUE);
36793680
#endif
36803681

36813682
#ifdef FEAT_AUTOCMD
@@ -4115,12 +4116,16 @@ set_errorlist(
41154116
qi->qf_lists[qi->qf_curlist].qf_nonevalid = TRUE;
41164117
else
41174118
qi->qf_lists[qi->qf_curlist].qf_nonevalid = FALSE;
4118-
qi->qf_lists[qi->qf_curlist].qf_ptr = qi->qf_lists[qi->qf_curlist].qf_start;
4119-
if (qi->qf_lists[qi->qf_curlist].qf_count > 0)
4120-
qi->qf_lists[qi->qf_curlist].qf_index = 1;
4119+
if (action != 'a') {
4120+
qi->qf_lists[qi->qf_curlist].qf_ptr =
4121+
qi->qf_lists[qi->qf_curlist].qf_start;
4122+
if (qi->qf_lists[qi->qf_curlist].qf_count > 0)
4123+
qi->qf_lists[qi->qf_curlist].qf_index = 1;
4124+
}
41214125

41224126
#ifdef FEAT_WINDOWS
4123-
qf_update_buffer(qi);
4127+
/* Don't update the cursor in quickfix window when appending entries */
4128+
qf_update_buffer(qi, (action != 'a'));
41244129
#endif
41254130

41264131
return retval;
@@ -4427,7 +4432,7 @@ ex_helpgrep(exarg_T *eap)
44274432
free_string_option(save_cpo);
44284433

44294434
#ifdef FEAT_WINDOWS
4430-
qf_update_buffer(qi);
4435+
qf_update_buffer(qi, TRUE);
44314436
#endif
44324437

44334438
#ifdef FEAT_AUTOCMD

src/tag.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,14 @@ do_tag(
200200
{
201201
use_tagstack = FALSE;
202202
new_tag = TRUE;
203+
#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
204+
if (g_do_tagpreview != 0)
205+
{
206+
vim_free(ptag_entry.tagname);
207+
if ((ptag_entry.tagname = vim_strsave(tag)) == NULL)
208+
goto end_do_tag;
209+
}
210+
#endif
203211
}
204212
else
205213
{

src/testdir/test_alot.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ source test_sort.vim
2727
source test_statusline.vim
2828
source test_syn_attr.vim
2929
source test_tabline.vim
30+
source test_tagjump.vim
3031
source test_timers.vim
3132
source test_undolevels.vim
3233
source test_unlet.vim

src/testdir/test_quickfix.vim

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,3 +697,51 @@ func Test_cgetexpr_works()
697697
" this must not crash Vim
698698
cgetexpr [$x]
699699
endfunc
700+
701+
" Tests for the setqflist() and setloclist() functions
702+
function SetXlistTests(cchar, bnum)
703+
if a:cchar == 'c'
704+
let Xsetlist = function('setqflist')
705+
let Xgetlist = function('getqflist')
706+
let Xnext = 'cnext'
707+
else
708+
let Xsetlist = function('setloclist', [0])
709+
let Xgetlist = function('getloclist', [0])
710+
let Xnext = 'lnext'
711+
endif
712+
713+
call Xsetlist([{'bufnr': a:bnum, 'lnum': 1},
714+
\ {'bufnr': a:bnum, 'lnum': 2}])
715+
let l = Xgetlist()
716+
call assert_equal(2, len(l))
717+
call assert_equal(2, l[1].lnum)
718+
719+
exe Xnext
720+
call Xsetlist([{'bufnr': a:bnum, 'lnum': 3}], 'a')
721+
let l = Xgetlist()
722+
call assert_equal(3, len(l))
723+
exe Xnext
724+
call assert_equal(3, line('.'))
725+
726+
call Xsetlist([{'bufnr': a:bnum, 'lnum': 3},
727+
\ {'bufnr': a:bnum, 'lnum': 4},
728+
\ {'bufnr': a:bnum, 'lnum': 5}], 'r')
729+
let l = Xgetlist()
730+
call assert_equal(3, len(l))
731+
call assert_equal(5, l[2].lnum)
732+
733+
call Xsetlist([])
734+
let l = Xgetlist()
735+
call assert_equal(0, len(l))
736+
endfunction
737+
738+
function Test_setqflist()
739+
new Xtestfile | only
740+
let bnum = bufnr('%')
741+
call setline(1, range(1,5))
742+
743+
call SetXlistTests('c', bnum)
744+
call SetXlistTests('l', bnum)
745+
746+
call delete('Xtestfile')
747+
endfunction

src/testdir/test_tagjump.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
" Tests for tagjump (tags and special searches)
2+
3+
" SEGV occurs in older versions. (At least 7.4.1748 or older)
4+
func Test_ptag_with_notagstack()
5+
set notagstack
6+
call assert_fails('ptag does_not_exist_tag_name', 'E426')
7+
set tagstack&vim
8+
endfunc
9+
" vim: sw=2 et

src/version.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,12 @@ static char *(features[]) =
763763

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
1752,
768+
/**/
769+
1751,
770+
/**/
771+
1750,
766772
/**/
767773
1749,
768774
/**/

0 commit comments

Comments
 (0)