Skip to content

Commit d0fef76

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents ac46984 + 1b9f9d3 commit d0fef76

15 files changed

Lines changed: 111 additions & 35 deletions

File tree

src/diff.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,9 +1702,7 @@ diff_equal_char(char_u *p1, char_u *p2, int *len)
17021702
diff_cmp(char_u *s1, char_u *s2)
17031703
{
17041704
char_u *p1, *p2;
1705-
#ifdef FEAT_MBYTE
17061705
int l;
1707-
#endif
17081706

17091707
if ((diff_flags & (DIFF_ICASE | DIFF_IWHITE)) == 0)
17101708
return STRCMP(s1, s2);
@@ -1983,10 +1981,8 @@ diff_find_change(
19831981
int idx;
19841982
int off;
19851983
int added = TRUE;
1986-
#ifdef FEAT_MBYTE
19871984
char_u *p1, *p2;
19881985
int l;
1989-
#endif
19901986

19911987
/* Make a copy of the line, the next ml_get() will invalidate it. */
19921988
line_org = vim_strsave(ml_get_buf(wp->w_buffer, lnum, FALSE));

src/evalfunc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9912,7 +9912,10 @@ set_buffer_lines(buf_T *buf, linenr_T lnum, typval_T *lines, typval_T *rettv)
99129912
buf_T *curbuf_save;
99139913
int is_curbuf = buf == curbuf;
99149914

9915-
if (buf == NULL || buf->b_ml.ml_mfp == NULL || lnum < 1)
9915+
/* When using the current buffer ml_mfp will be set if needed. Useful when
9916+
* setline() is used on startup. For other buffers the buffer must be
9917+
* loaded. */
9918+
if (buf == NULL || (!is_curbuf && buf->b_ml.ml_mfp == NULL) || lnum < 1)
99169919
{
99179920
rettv->vval.v_number = 1; /* FAIL */
99189921
return;

src/getchar.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1598,8 +1598,13 @@ vgetc(void)
15981598
{
15991599
int did_inc = FALSE;
16001600

1601-
if (mod_mask) /* no mapping after modifier has been read */
1601+
if (mod_mask
1602+
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
1603+
|| im_is_preediting()
1604+
#endif
1605+
)
16021606
{
1607+
/* no mapping after modifier has been read */
16031608
++no_mapping;
16041609
++allow_keys;
16051610
did_inc = TRUE; /* mod_mask may change value */

src/libvterm/src/screen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static int moverect_internal(VTermRect dest, VTermRect src, void *user)
214214
VTermPos pos;
215215
for(pos.row = 0; pos.row < src.start_row; pos.row++) {
216216
for(pos.col = 0; pos.col < screen->cols; pos.col++)
217-
vterm_screen_get_cell(screen, pos, screen->sb_buffer + pos.col);
217+
(void)vterm_screen_get_cell(screen, pos, screen->sb_buffer + pos.col);
218218

219219
(screen->callbacks->sb_pushline)(screen->cols, screen->sb_buffer, screen->cbdata);
220220
}

src/libvterm/src/state.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,7 @@ static void request_dec_mode(VTermState *state, int num)
878878

879879
case 2004:
880880
reply = state->mode.bracketpaste;
881+
break;
881882

882883
default:
883884
vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "?%d;%d$y", num, 0);

src/mbyte.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4983,7 +4983,11 @@ im_delete_preedit(void)
49834983
}
49844984
# endif
49854985

4986-
if (State & NORMAL)
4986+
if (State & NORMAL
4987+
#ifdef FEAT_TERMINAL
4988+
&& !term_use_loop()
4989+
#endif
4990+
)
49874991
{
49884992
im_preedit_cursor = 0;
49894993
return;

src/os_unix.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5714,7 +5714,10 @@ mch_create_pty_channel(job_T *job, jobopt_T *options)
57145714

57155715
channel = add_channel();
57165716
if (channel == NULL)
5717+
{
5718+
close(pty_master_fd);
57175719
return FAIL;
5720+
}
57185721
job->jv_channel = channel; /* ch_refcount was set by add_channel() */
57195722
channel->ch_keep_open = TRUE;
57205723

src/term.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4578,12 +4578,12 @@ check_termcode(
45784578
&& STRNCMP(tp + extra - 2, "1;95;0c", 7) == 0)
45794579
is_not_xterm = TRUE;
45804580
# endif
4581-
/* Gnome terminal sends 1;3801;0 or 1;4402;0.
4581+
/* Gnome terminal sends 1;3801;0, 1;4402;0 or 1;2501;0.
45824582
* xfce4-terminal sends 1;2802;0.
45834583
* screen sends 83;40500;0
4584-
* Assuming any version number over 2800 is not an
4584+
* Assuming any version number over 2500 is not an
45854585
* xterm (without the limit for rxvt and screen). */
4586-
if (col >= 2800)
4586+
if (col >= 2500)
45874587
is_not_xterm = TRUE;
45884588

45894589
/* PuTTY sends 0;136;0 */

src/terminal.c

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
* in tl_scrollback are no longer used.
3939
*
4040
* TODO:
41-
* - ":term NONE" does not work in MS-Windows.
41+
* - ":term NONE" does not work on MS-Windows.
42+
* https://github.com/vim/vim/pull/2056
43+
* - Redirecting output does not work on MS-Windows.
4244
* - implement term_setsize()
4345
* - add test for giving error for invalid 'termsize' value.
4446
* - support minimal size when 'termsize' is "rows*cols".
@@ -56,6 +58,8 @@
5658
* - In the GUI use a terminal emulator for :!cmd.
5759
* - Copy text in the vterm to the Vim buffer once in a while, so that
5860
* completion works.
61+
* - add an optional limit for the scrollback size. When reaching it remove
62+
* 10% at the start.
5963
*/
6064

6165
#include "vim.h"
@@ -366,10 +370,10 @@ term_start(typval_T *argvar, jobopt_T *opt, int forceit)
366370
}
367371
else if (argvar->v_type != VAR_LIST
368372
|| argvar->vval.v_list == NULL
369-
|| argvar->vval.v_list->lv_len < 1)
373+
|| argvar->vval.v_list->lv_len < 1
374+
|| (cmd = get_tv_string_chk(
375+
&argvar->vval.v_list->lv_first->li_tv)) == NULL)
370376
cmd = (char_u*)"";
371-
else
372-
cmd = get_tv_string_chk(&argvar->vval.v_list->lv_first->li_tv);
373377

374378
len = STRLEN(cmd) + 10;
375379
p = alloc((int)len);
@@ -458,7 +462,7 @@ term_start(typval_T *argvar, jobopt_T *opt, int forceit)
458462
void
459463
ex_terminal(exarg_T *eap)
460464
{
461-
typval_T argvar;
465+
typval_T argvar[2];
462466
jobopt_T opt;
463467
char_u *cmd;
464468
char_u *tofree = NULL;
@@ -521,8 +525,8 @@ ex_terminal(exarg_T *eap)
521525
}
522526
cmd = skipwhite(p);
523527
}
524-
if (cmd == NULL || *cmd == NUL)
525-
/* Make a copy, an autocommand may set 'shell'. */
528+
if (*cmd == NUL)
529+
/* Make a copy of 'shell', an autocommand may change the option. */
526530
tofree = cmd = vim_strsave(p_sh);
527531

528532
if (eap->addr_count > 0)
@@ -535,9 +539,10 @@ ex_terminal(exarg_T *eap)
535539
opt.jo_in_bot = eap->line2;
536540
}
537541

538-
argvar.v_type = VAR_STRING;
539-
argvar.vval.v_string = cmd;
540-
term_start(&argvar, &opt, eap->forceit);
542+
argvar[0].v_type = VAR_STRING;
543+
argvar[0].vval.v_string = cmd;
544+
argvar[1].v_type = VAR_UNKNOWN;
545+
term_start(argvar, &opt, eap->forceit);
541546
vim_free(tofree);
542547
}
543548

@@ -2887,7 +2892,8 @@ f_term_wait(typval_T *argvars, typval_T *rettv UNUSED)
28872892
&& STRCMP(job_status(buf->b_term->tl_job), "dead") == 0)
28882893
{
28892894
/* The job is dead, keep reading channel I/O until the channel is
2890-
* closed. */
2895+
* closed. buf->b_term may become NULL if the terminal was closed while
2896+
* waiting. */
28912897
ch_log(NULL, "term_wait(): waiting for channel to close");
28922898
while (buf->b_term != NULL && !buf->b_term->tl_channel_closed)
28932899
{

src/testdir/shared.vim

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,21 @@ func s:feedkeys(timer)
166166
endfunc
167167

168168
" Get the command to run Vim, with -u NONE and --not-a-term arguments.
169+
" If there is an argument use it instead of "NONE".
169170
" Returns an empty string on error.
170-
func GetVimCommand()
171+
func GetVimCommand(...)
171172
if !filereadable('vimcmd')
172173
return ''
173174
endif
175+
if a:0 == 0
176+
let name = 'NONE'
177+
else
178+
let name = a:1
179+
endif
174180
let cmd = readfile('vimcmd')[0]
175-
let cmd = substitute(cmd, '-u \f\+', '-u NONE', '')
176-
if cmd !~ '-u NONE'
177-
let cmd = cmd . ' -u NONE'
181+
let cmd = substitute(cmd, '-u \f\+', '-u ' . name, '')
182+
if cmd !~ '-u '. name
183+
let cmd = cmd . ' -u ' . name
178184
endif
179185
let cmd .= ' --not-a-term'
180186
let cmd = substitute(cmd, 'VIMRUNTIME=.*VIMRUNTIME;', '', '')

0 commit comments

Comments
 (0)