Skip to content

Commit a060c75

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 321a0c8 + 07c043a commit a060c75

28 files changed

+237
-255
lines changed

src/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,6 +2154,7 @@ test_arglist \
21542154
test_crypt \
21552155
test_cscope \
21562156
test_cursor_func \
2157+
test_curswant \
21572158
test_delete \
21582159
test_diffmode \
21592160
test_digraph \
@@ -2172,6 +2173,7 @@ test_arglist \
21722173
test_farsi \
21732174
test_feedkeys \
21742175
test_file_perm \
2176+
test_file_size \
21752177
test_fileformat \
21762178
test_filetype \
21772179
test_filter_cmd \
@@ -2206,6 +2208,8 @@ test_arglist \
22062208
test_lambda \
22072209
test_langmap \
22082210
test_largefile \
2211+
test_let \
2212+
test_lineending \
22092213
test_lispwords \
22102214
test_listlbr \
22112215
test_listlbr_utf8 \
@@ -2250,6 +2254,7 @@ test_arglist \
22502254
test_reltime \
22512255
test_retab \
22522256
test_ruby \
2257+
test_scrollbind \
22532258
test_search \
22542259
test_searchpos \
22552260
test_set \

src/buffer.c

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5804,9 +5804,52 @@ buf_spname(buf_T *buf)
58045804
return NULL;
58055805
}
58065806

5807-
#if (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)) \
5807+
#if defined(FEAT_JOB_CHANNEL) \
58085808
|| defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) \
58095809
|| defined(PROTO)
5810+
# define SWITCH_TO_WIN
5811+
5812+
/*
5813+
* Find a window that contains "buf" and switch to it.
5814+
* If there is no such window, use the current window and change "curbuf".
5815+
* Caller must initialize save_curbuf to NULL.
5816+
* restore_win_for_buf() MUST be called later!
5817+
*/
5818+
void
5819+
switch_to_win_for_buf(
5820+
buf_T *buf,
5821+
win_T **save_curwinp,
5822+
tabpage_T **save_curtabp,
5823+
bufref_T *save_curbuf)
5824+
{
5825+
win_T *wp;
5826+
tabpage_T *tp;
5827+
5828+
if (find_win_for_buf(buf, &wp, &tp) == FAIL)
5829+
switch_buffer(save_curbuf, buf);
5830+
else if (switch_win(save_curwinp, save_curtabp, wp, tp, TRUE) == FAIL)
5831+
{
5832+
restore_win(*save_curwinp, *save_curtabp, TRUE);
5833+
switch_buffer(save_curbuf, buf);
5834+
}
5835+
}
5836+
5837+
void
5838+
restore_win_for_buf(
5839+
win_T *save_curwin,
5840+
tabpage_T *save_curtab,
5841+
bufref_T *save_curbuf)
5842+
{
5843+
if (save_curbuf->br_buf == NULL)
5844+
restore_win(save_curwin, save_curtab, TRUE);
5845+
else
5846+
restore_buffer(save_curbuf);
5847+
}
5848+
#endif
5849+
5850+
#if (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)) \
5851+
|| defined(SWITCH_TO_WIN) \
5852+
|| defined(PROTO)
58105853
/*
58115854
* Find a window for buffer "buf".
58125855
* If found OK is returned and "wp" and "tp" are set to the window and tabpage.

src/channel.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2305,7 +2305,9 @@ invoke_one_time_callback(
23052305
static void
23062306
append_to_buffer(buf_T *buffer, char_u *msg, channel_T *channel, ch_part_T part)
23072307
{
2308-
buf_T *save_curbuf = curbuf;
2308+
bufref_T save_curbuf = {NULL, 0, 0};
2309+
win_T *save_curwin = NULL;
2310+
tabpage_T *save_curtab = NULL;
23092311
linenr_T lnum = buffer->b_ml.ml_line_count;
23102312
int save_write_to = buffer->b_write_to_channel;
23112313
chanpart_T *ch_part = &channel->ch_part[part];
@@ -2334,8 +2336,10 @@ append_to_buffer(buf_T *buffer, char_u *msg, channel_T *channel, ch_part_T part)
23342336
ch_log(channel, "appending line %d to buffer", (int)lnum + 1 - empty);
23352337

23362338
buffer->b_p_ma = TRUE;
2337-
curbuf = buffer;
2338-
curwin->w_buffer = curbuf;
2339+
2340+
/* Save curbuf/curwin/curtab and make "buffer" the current buffer. */
2341+
switch_to_win_for_buf(buffer, &save_curwin, &save_curtab, &save_curbuf);
2342+
23392343
u_sync(TRUE);
23402344
/* ignore undo failure, undo is not very useful here */
23412345
ignored = u_save(lnum - empty, lnum + 1);
@@ -2349,8 +2353,10 @@ append_to_buffer(buf_T *buffer, char_u *msg, channel_T *channel, ch_part_T part)
23492353
else
23502354
ml_append(lnum, msg, 0, FALSE);
23512355
appended_lines_mark(lnum, 1L);
2352-
curbuf = save_curbuf;
2353-
curwin->w_buffer = curbuf;
2356+
2357+
/* Restore curbuf/curwin/curtab */
2358+
restore_win_for_buf(save_curwin, save_curtab, &save_curbuf);
2359+
23542360
if (ch_part->ch_nomodifiable)
23552361
buffer->b_p_ma = FALSE;
23562362
else
@@ -2359,7 +2365,6 @@ append_to_buffer(buf_T *buffer, char_u *msg, channel_T *channel, ch_part_T part)
23592365
if (buffer->b_nwindows > 0)
23602366
{
23612367
win_T *wp;
2362-
win_T *save_curwin;
23632368

23642369
FOR_ALL_WINDOWS(wp)
23652370
{

src/if_py_both.h

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4262,43 +4262,6 @@ py_fix_cursor(linenr_T lo, linenr_T hi, linenr_T extra)
42624262
invalidate_botline();
42634263
}
42644264

4265-
/*
4266-
* Find a window that contains "buf" and switch to it.
4267-
* If there is no such window, use the current window and change "curbuf".
4268-
* Caller must initialize save_curbuf to NULL.
4269-
* restore_win_for_buf() MUST be called later!
4270-
*/
4271-
static void
4272-
switch_to_win_for_buf(
4273-
buf_T *buf,
4274-
win_T **save_curwinp,
4275-
tabpage_T **save_curtabp,
4276-
bufref_T *save_curbuf)
4277-
{
4278-
win_T *wp;
4279-
tabpage_T *tp;
4280-
4281-
if (find_win_for_buf(buf, &wp, &tp) == FAIL)
4282-
switch_buffer(save_curbuf, buf);
4283-
else if (switch_win(save_curwinp, save_curtabp, wp, tp, TRUE) == FAIL)
4284-
{
4285-
restore_win(*save_curwinp, *save_curtabp, TRUE);
4286-
switch_buffer(save_curbuf, buf);
4287-
}
4288-
}
4289-
4290-
static void
4291-
restore_win_for_buf(
4292-
win_T *save_curwin,
4293-
tabpage_T *save_curtab,
4294-
bufref_T *save_curbuf)
4295-
{
4296-
if (save_curbuf->br_buf == NULL)
4297-
restore_win(save_curwin, save_curtab, TRUE);
4298-
else
4299-
restore_buffer(save_curbuf);
4300-
}
4301-
43024265
/*
43034266
* Replace a line in the specified buffer. The line number is
43044267
* in Vim format (1-based). The replacement line is given as

src/proto/buffer.pro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ int bt_dontwrite(buf_T *buf);
6161
int bt_dontwrite_msg(buf_T *buf);
6262
int buf_hide(buf_T *buf);
6363
char_u *buf_spname(buf_T *buf);
64+
void switch_to_win_for_buf(buf_T *buf, win_T **save_curwinp, tabpage_T **save_curtabp, bufref_T *save_curbuf);
65+
void restore_win_for_buf(win_T *save_curwin, tabpage_T *save_curtab, bufref_T *save_curbuf);
6466
int find_win_for_buf(buf_T *buf, win_T **wp, tabpage_T **tp);
6567
void buf_addsign(buf_T *buf, int id, linenr_T lnum, int typenr);
6668
linenr_T buf_change_sign_type(buf_T *buf, int markId, int typenr);

src/terminal.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,8 +696,11 @@ move_terminal_to_buffer(term_T *term)
696696
VTermPos pos;
697697
VTermScreenCell cell;
698698
VTermScreenCell *p;
699-
VTermScreen *screen = vterm_obtain_screen(term->tl_vterm);
699+
VTermScreen *screen;
700700

701+
if (term->tl_vterm == NULL)
702+
return;
703+
screen = vterm_obtain_screen(term->tl_vterm);
701704
for (pos.row = 0; pos.row < term->tl_rows; ++pos.row)
702705
{
703706
len = 0;

src/testdir/Make_all.mak

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@ SCRIPTS_ALL = \
1818
test5.out \
1919
test7.out \
2020
test8.out \
21-
test9.out \
2221
test14.out \
2322
test15.out \
2423
test19.out \
2524
test20.out \
26-
test22.out \
2725
test28.out \
2826
test29.out \
2927
test31.out \
@@ -52,18 +50,14 @@ SCRIPTS_ALL = \
5250
test69.out \
5351
test70.out \
5452
test73.out \
55-
test77.out \
5653
test79.out \
5754
test80.out \
58-
test84.out \
5955
test88.out \
6056
test91.out \
6157
test94.out \
6258
test95.out \
63-
test98.out \
6459
test99.out \
6560
test103.out \
66-
test104.out \
6761
test107.out \
6862
test108.out \
6963
test_autoformat_join.out \
@@ -137,11 +131,13 @@ NEW_TESTS = test_arabic.res \
137131
test_command_count.res \
138132
test_crypt.res \
139133
test_cscope.res \
134+
test_curswant.res \
140135
test_diffmode.res \
141136
test_digraph.res \
142137
test_display.res \
143138
test_edit.res \
144139
test_farsi.res \
140+
test_file_size.res \
145141
test_fnameescape.res \
146142
test_fold.res \
147143
test_gf.res \
@@ -158,6 +154,8 @@ NEW_TESTS = test_arabic.res \
158154
test_job_fails.res \
159155
test_json.res \
160156
test_langmap.res \
157+
test_let.res \
158+
test_lineending.res \
161159
test_listlbr.res \
162160
test_listlbr_utf8.res \
163161
test_lua.res \
@@ -186,6 +184,7 @@ NEW_TESTS = test_arabic.res \
186184
test_retab.res \
187185
test_registers.res \
188186
test_ruby.res \
187+
test_scrollbind.res \
189188
test_search.res \
190189
test_signs.res \
191190
test_smartindent.res \

src/testdir/Make_vms.mms

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@
5454
# Comment out if you have GNU compatible diff on your system
5555
# HAVE_GDIFF = YES
5656

57-
# Comment out if you have GNU compatible cksum on your system
58-
# HAVE_CKSUM = YES
59-
6057
# Comment out if you have ICONV support
6158
# HAVE_ICONV = YES
6259

@@ -77,9 +74,9 @@ VIMPROG = <->vim.exe
7774
.SUFFIXES : .out .in
7875

7976
SCRIPT = test1.out test3.out test4.out test5.out \
80-
test7.out test8.out test9.out \
77+
test7.out test8.out \
8178
test14.out test15.out \
82-
test19.out test20.out test22.out \
79+
test19.out test20.out \
8380
test28.out test29.out test30.out test31.out test32.out \
8481
test33.out test34.out test36.out test37.out \
8582
test38.out test39.out test40.out test41.out test42.out \
@@ -90,10 +87,10 @@ SCRIPT = test1.out test3.out test4.out test5.out \
9087
test66.out test68.out test69.out \
9188
test72.out \
9289
test77a.out test78.out test79.out test80.out \
93-
test84.out test88.out \
90+
test88.out \
9491
test91.out test94.out \
95-
test95.out test98.out test99.out \
96-
test103.out test104.out \
92+
test95.out test99.out \
93+
test103.out \
9794
test107.out test108.out\
9895
test_autocmd_option.out \
9996
test_autoformat_join.out \
@@ -164,10 +161,6 @@ SCRIPT_GZIP = test11.out
164161
SCRIPT_GDIFF = test47.out
165162
.ENDIF
166163

167-
.IFDEF HAVE_CKSUM
168-
SCRIPT_CKSUM = test77.out
169-
.ENDIF
170-
171164
.IFDEF HAVE_ICONV
172165
SCRIPT_ICONV = test83.out
173166
.ENDIF
@@ -201,7 +194,7 @@ SCRIPT_PYTHON = test86.out test87.out
201194
-@ if "''F$SEARCH("Xtest.*")'" .NES. "" then delete/noconfirm/nolog Xtest.*.*
202195

203196
all : clean nolog $(START_WITH) $(SCRIPT) $(SCRIPT_GUI) $(SCRIPT_UNIX) $(SCRIPT_WIN) $(SCRIPT_SPELL) $(SCRIPT_ODS5) $(SCRIPT_GZIP) \
204-
$(SCRIPT_GDIFF) $(SCRIPT_MZSCH) $(SCRIPT_CKSUM) $(SCRIPT_ICONV) $(SCRIPT_LUA) $(SCRIPT_PYTHON) nolog
197+
$(SCRIPT_GDIFF) $(SCRIPT_MZSCH) $(SCRIPT_ICONV) $(SCRIPT_LUA) $(SCRIPT_PYTHON) nolog
205198
-@ write sys$output " "
206199
-@ write sys$output "-----------------------------------------------"
207200
-@ write sys$output " All done"
@@ -232,7 +225,6 @@ nolog :
232225
-@ write sys$output " HAVE_ODS5 = ""$(HAVE_ODS5)"" "
233226
-@ write sys$output " HAVE_GZIP = ""$(HAVE_GZIP)"" "
234227
-@ write sys$output " HAVE_GDIFF = ""$(HAVE_GDIFF)"" "
235-
-@ write sys$output " HAVE_CKSUM = ""$(HAVE_CKSUM)"" "
236228
-@ write sys$output " HAVE_ICONV = ""$(HAVE_ICONV)"" "
237229
-@ write sys$output " HAVE_LUA = ""$(HAVE_LUA)"" "
238230
-@ write sys$output " HAVE_PYTHON= ""$(HAVE_PYTHON)"" "

src/testdir/main.aap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
VimProg ?= ../vim
66

77
Scripts = test1.out test2.out test3.out test4.out test5.out test6.out
8-
test7.out test8.out test9.out test11.out
8+
test7.out test8.out test11.out
99
test12.out test13.out test14.out test15.out test17.out
10-
test18.out test19.out test20.out test21.out test22.out
10+
test18.out test19.out test20.out test21.out
1111
test25.out test27.out
1212
test28.out test29.out test30.out test31.out test32.out
1313
test33.out test34.out test36.out test37.out

src/testdir/test104.in

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)