Merge remote-tracking branch 'vim/master'

This commit is contained in:
Kazuki Sakamoto
2018-04-14 15:32:03 -07:00
20 changed files with 388 additions and 46 deletions
+29 -2
View File
@@ -6138,6 +6138,8 @@ mkdir({name} [, {path} [, {prot}]])
Example: >
:call mkdir($HOME . "/tmp/foo/bar", "p", 0700)
< This function is not available in the |sandbox|.
There is no error if the directory already exists and the "p"
flag is passed (since patch 8.0.1708).
Not available on all systems. To check use: >
:if exists("*mkdir")
<
@@ -8400,6 +8402,24 @@ term_setansicolors({buf}, {colors}) *term_setansicolors()*
color codes, like those accepted by |highlight-guifg|.
Also see |term_getansicolors()| and |g:terminal_ansi_colors|.
The colors normally are:
0 black
1 dark red
2 dark green
3 brown
4 dark blue
5 dark magenta
6 dark cyan
7 light grey
8 dark grey
9 red
10 green
11 yellow
12 blue
13 magenta
14 cyan
15 white
These colors are used in the GUI and in the terminal when
'termguicolors' is set. When not using GUI colors (GUI mode
or |termguicolors|), the terminal window always uses the 16
@@ -8429,8 +8449,15 @@ term_setrestore({buf}, {command}) *term_setrestore()*
Use "NONE" to not restore this window.
{only available when compiled with the |+terminal| feature}
term_setsize({buf}, {expr}) *term_setsize()*
Not implemented yet.
term_setsize({buf}, {rows}, {cols}) *term_setsize()*
Set the size of terminal {buf}. The size of the window
containing the terminal will also be adjusted, if possible.
If {rows} or {cols} is zero or negative, that dimension is not
changed.
{buf} must be the buffer number of a terminal window. Use an
empty string for the current buffer. If the buffer does not
exist or is not a terminal window, an error is given.
{only available when compiled with the |+terminal| feature}
term_start({cmd}, {options}) *term_start()*
+11 -1
View File
@@ -1,4 +1,4 @@
*options.txt* For Vim version 8.0. Last change: 2018 Mar 13
*options.txt* For Vim version 8.0. Last change: 2018 Apr 14
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -8097,6 +8097,16 @@ A jump table for the options with a short description can be found at |Q_op|.
Note that the "cterm" attributes are still used, not the "gui" ones.
NOTE: This option is reset when 'compatible' is set.
*'terminalscroll'* *'tlsl'*
'terminalscroll' 'tlsl' number (default 10000)
global
{not in Vi}
{not available when compiled without the
|+terminal| feature}
Number of scrollback lines to keep. When going over this limit the
first 10% of the scrollback lines are deleted. This is just to reduce
the memory usage. See |Terminal-Normal|.
*'termkey'* *'tk'*
'termkey' 'tk' string (default "")
local to window
+16 -3
View File
@@ -72,6 +72,7 @@ See |CTRL-W| for more commands.
Special in the terminal window: *CTRL-W_.* *CTRL-W_N*
CTRL-W . send a CTRL-W to the job in the terminal
CTRL-W CTRL-\ send a CTRL-\ to the job in the terminal
CTRL-W N go to Terminal-Normal mode, see |Terminal-mode|
CTRL-\ CTRL-N go to Terminal-Normal mode, see |Terminal-mode|
CTRL-W " {reg} paste register {reg} *CTRL-W_quote*
@@ -287,7 +288,7 @@ not when 'termsize' is "rowsXcols".
Terminal-Job and Terminal-Normal mode ~
*Terminal-mode*
*Terminal-mode* *Terminal-Job*
When the job is running the contents of the terminal is under control of the
job. That includes the cursor position. Typed keys are sent to the job.
The terminal contents can change at any time. This is called Terminal-Job
@@ -300,7 +301,9 @@ suspended. CTRL-\ CTRL-N does the same.
Terminal-Job mode is where |:tmap| mappings are applied. Keys sent by
|term_sendkeys()| are not subject to tmap, but keys from |feedkeys()| are.
*E946*
It is not possible to enter Insert mode from Terminal-Job mode.
*Terminal-Normal* *E946*
In Terminal-Normal mode you can move the cursor around with the usual Vim
commands, Visually mark text, yank text, etc. But you cannot change the
contents of the buffer. The commands that would start insert mode, such as
@@ -311,7 +314,10 @@ In Terminal-Normal mode the statusline and window title show "(Terminal)". If
the job ends while in Terminal-Normal mode this changes to
"(Terminal-finished)".
It is not possible to enter Insert mode from Terminal-Job mode.
When the job outputs lines in the terminal, such that the contents scrolls off
the top, those lines are remembered and can be seen in Terminal-Normal mode.
The number of lines is limited by the 'terminalscroll' option. When going over
this limit, the first 10% of the scrolled lins are deleted and are lost.
Cursor style ~
@@ -643,6 +649,13 @@ the same as any command running in a terminal window.
When the debugger ends, typically by typing "quit" in the gdb window, the two
opened windows are closed.
Only one debugger can be active at a time.
To attach gdb to an already running executable, or use a core file, pass extra
arguments. E.g.: >
:Termdebug vim core
:Termdebug vim 98343
Example session ~
*termdebug-example*
+11 -4
View File
@@ -25,7 +25,7 @@ endif
" The command that starts debugging, e.g. ":Termdebug vim".
" To end type "quit" in the gdb window.
command -nargs=* -complete=file Termdebug call s:StartDebug(<q-args>)
command -nargs=* -complete=file Termdebug call s:StartDebug(<f-args>)
" Name of the gdb command, defaults to "gdb".
if !exists('termdebugger')
@@ -43,7 +43,12 @@ else
endif
hi default debugBreakpoint term=reverse ctermbg=red guibg=red
func s:StartDebug(cmd)
func s:StartDebug(...)
if exists('s:gdbwin')
echoerr 'Terminal debugger already running'
return
endif
let s:startwin = win_getid(winnr())
let s:startsigncolumn = &signcolumn
@@ -90,7 +95,7 @@ func s:StartDebug(cmd)
" Open a terminal window to run the debugger.
" Add -quiet to avoid the intro message causing a hit-enter prompt.
let cmd = [g:termdebugger, '-quiet', '-tty', pty, a:cmd]
let cmd = [g:termdebugger, '-quiet', '-tty', pty] + a:000
echomsg 'executing "' . join(cmd) . '"'
let s:gdbbuf = term_start(cmd, {
\ 'exit_cb': function('s:EndDebug'),
@@ -112,7 +117,7 @@ func s:StartDebug(cmd)
let try_count = 0
while 1
let response = ''
for lnum in range(1,20)
for lnum in range(1,200)
if term_getline(s:gdbbuf, lnum) =~ 'new-ui mi '
let response = term_getline(s:gdbbuf, lnum + 1)
if response =~ 'Undefined command'
@@ -182,6 +187,7 @@ endfunc
func s:EndDebug(job, status)
exe 'bwipe! ' . s:ptybuf
exe 'bwipe! ' . s:commbuf
unlet s:gdbwin
let curwinid = win_getid(winnr())
@@ -295,6 +301,7 @@ func s:DeleteCommands()
delcommand Evaluate
delcommand Gdb
delcommand Program
delcommand Source
delcommand Winbar
nunmap K
+98 -1
View File
@@ -3447,6 +3447,97 @@ ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
if ${ac_cv_prog_cc_c89+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_prog_cc_c89=no
ac_save_CC=$CC
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not '\xHH' hex character constants.
These don't provoke an error unfortunately, instead are silently treated
as 'x'. The following induces an error, until -std is added to get
proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
array size at least. It's necessary to write '\x00'==0 to get something
that's true only with -std. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
inside strings and character constants. */
#define FOO(x) 'x'
int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
;
return 0;
}
_ACEOF
for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_c89=$ac_arg
fi
rm -f core conftest.err conftest.$ac_objext
test "x$ac_cv_prog_cc_c89" != "xno" && break
done
rm -f conftest.$ac_ext
CC=$ac_save_CC
fi
# AC_CACHE_VAL
case "x$ac_cv_prog_cc_c89" in
x)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
$as_echo "none needed" >&6; } ;;
xno)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
$as_echo "unsupported" >&6; } ;;
*)
CC="$CC $ac_cv_prog_cc_c89"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
esac
if test "x$ac_cv_prog_cc_c89" != xno; then :
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -4113,6 +4204,8 @@ if test "$GCC" = yes; then
CFLAGS="$CFLAGS -fno-strength-reduce"
fi
fi
CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang version" >&5
@@ -4185,7 +4278,7 @@ if test "`(uname) 2>/dev/null`" = Darwin; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
MACOS_X=yes
CPPFLAGS="$CPPFLAGS -DMACOS_X"
CPPFLAGS="$CPPFLAGS -D_DARWIN_C_SOURCE -DMACOS_X"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-darwin argument" >&5
$as_echo_n "checking --disable-darwin argument... " >&6; }
@@ -14473,6 +14566,10 @@ if test "$zOSUnix" = "yes"; then
CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll"
fi
if test "$GCC" = yes -a "$GUITYPE" != "GTK" -a "X$RUBY_CFLAGS" = "X"; then
CFLAGS="$CFLAGS -ansi"
fi
ac_config_files="$ac_config_files auto/config.mk:config.mk.in"
cat >confcache <<\_ACEOF
+3 -3
View File
@@ -691,9 +691,9 @@ channel_open(
{
char *p;
/* When using host->h_addr directly ubsan warns for it to not be
* aligned. First copy the pointer to aviod that. */
memcpy(&p, &host->h_addr, sizeof(p));
/* When using host->h_addr_list[0] directly ubsan warns for it to not
* be aligned. First copy the pointer to avoid that. */
memcpy(&p, &host->h_addr_list[0], sizeof(p));
memcpy((char *)&server.sin_addr, p, host->h_length);
}
+12 -2
View File
@@ -11,7 +11,7 @@ AC_DEFINE(UNIX)
AC_PROG_MAKE_SET
dnl Checks for programs.
AC_PROG_CC dnl required by almost everything
AC_PROG_CC_C89 dnl required by almost everything
AC_PROG_CPP dnl required by header file checks
AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP
AC_PROG_FGREP dnl finds working grep -F
@@ -61,6 +61,9 @@ if test "$GCC" = yes; then
CFLAGS="$CFLAGS -fno-strength-reduce"
fi
fi
dnl Declare what standards the code should comply with
CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700"
fi
dnl clang-500.2.75 or around has abandoned -f[no-]strength-reduce and issues a
@@ -135,7 +138,7 @@ AC_MSG_CHECKING([for Darwin (Mac OS X)])
if test "`(uname) 2>/dev/null`" = Darwin; then
AC_MSG_RESULT(yes)
MACOS_X=yes
CPPFLAGS="$CPPFLAGS -DMACOS_X"
CPPFLAGS="$CPPFLAGS -D_DARWIN_C_SOURCE -DMACOS_X"
AC_MSG_CHECKING(--disable-darwin argument)
AC_ARG_ENABLE(darwin,
@@ -4500,6 +4503,13 @@ if test "$zOSUnix" = "yes"; then
CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll"
fi
dnl Declare what standards the code should comply with.
dnl But not when using GTK, the header files cause all kinds of warnings.
dnl But not when using Ruby, it needs "inline".
if test "$GCC" = yes -a "$GUITYPE" != "GTK" -a "X$RUBY_CFLAGS" = "X"; then
CFLAGS="$CFLAGS -ansi"
fi
dnl write output files
AC_OUTPUT(auto/config.mk:config.mk.in)
+23 -12
View File
@@ -876,6 +876,7 @@ static struct fst
# endif
{"term_setkill", 2, 2, f_term_setkill},
{"term_setrestore", 2, 2, f_term_setrestore},
{"term_setsize", 3, 3, f_term_setsize},
{"term_start", 1, 2, f_term_start},
{"term_wait", 1, 2, f_term_wait},
#endif
@@ -8076,22 +8077,32 @@ f_mkdir(typval_T *argvars, typval_T *rettv)
dir = get_tv_string_buf(&argvars[0], buf);
if (*dir == NUL)
rettv->vval.v_number = FAIL;
else
{
if (*gettail(dir) == NUL)
/* remove trailing slashes */
*gettail_sep(dir) = NUL;
return;
if (argvars[1].v_type != VAR_UNKNOWN)
if (*gettail(dir) == NUL)
/* remove trailing slashes */
*gettail_sep(dir) = NUL;
if (argvars[1].v_type != VAR_UNKNOWN)
{
if (argvars[2].v_type != VAR_UNKNOWN)
{
if (argvars[2].v_type != VAR_UNKNOWN)
prot = (int)get_tv_number_chk(&argvars[2], NULL);
if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0)
mkdir_recurse(dir, prot);
prot = (int)get_tv_number_chk(&argvars[2], NULL);
if (prot == -1)
return;
}
if (STRCMP(get_tv_string(&argvars[1]), "p") == 0)
{
if (mch_isdir(dir))
{
/* With the "p" flag it's OK if the dir already exists. */
rettv->vval.v_number = OK;
return;
}
mkdir_recurse(dir, prot);
}
rettv->vval.v_number = prot == -1 ? FAIL : vim_mkdir_emsg(dir, prot);
}
rettv->vval.v_number = vim_mkdir_emsg(dir, prot);
}
#endif
+7 -5
View File
@@ -5607,15 +5607,17 @@ gui_mch_free_font(GuiFont font)
guicolor_T
gui_mch_get_color(char_u *name)
{
guicolor_T color = INVALCOLOR;
if (!gui.in_use) /* can't do this when GUI not running */
return INVALCOLOR;
return color;
if (name != NULL)
color = gui_get_color_cmn(name);
#if GTK_CHECK_VERSION(3,0,0)
return name != NULL ? gui_get_color_cmn(name) : INVALCOLOR;
return color;
#else
guicolor_T color;
color = (name != NULL) ? gui_get_color_cmn(name) : INVALCOLOR;
if (color == INVALCOLOR)
return INVALCOLOR;
+1 -1
View File
@@ -815,7 +815,7 @@ python3_end(void)
#endif
if (Py_IsInitialized())
{
// acquire lock before finalizing
/* acquire lock before finalizing */
PyGILState_Ensure();
Py_Finalize();
+9
View File
@@ -2824,6 +2824,15 @@ static struct vimoption options[] =
#else
(char_u*)NULL, PV_NONE,
{(char_u *)FALSE, (char_u *)FALSE}
#endif
SCRIPTID_INIT},
{"terminalscroll", "tlsl", P_NUM|P_VI_DEF|P_VIM|P_RBUF,
#ifdef FEAT_TERMINAL
(char_u *)&p_tlsl, PV_NONE,
{(char_u *)10000L, (char_u *)10000L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"termkey", "tk", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF,
+3
View File
@@ -868,6 +868,9 @@ EXTERN char_u *p_tcldll; /* 'tcldll' */
#ifdef FEAT_ARABIC
EXTERN int p_tbidi; /* 'termbidi' */
#endif
#ifdef FEAT_TERMINAL
EXTERN long p_tlsl; /* 'terminalscroll' */
#endif
#ifdef FEAT_MBYTE
EXTERN char_u *p_tenc; /* 'termencoding' */
#endif
+2 -1
View File
@@ -32,19 +32,20 @@ int term_swap_diff(void);
void f_term_dumpdiff(typval_T *argvars, typval_T *rettv);
void f_term_dumpload(typval_T *argvars, typval_T *rettv);
void f_term_getaltscreen(typval_T *argvars, typval_T *rettv);
void f_term_getansicolors(typval_T *argvars, typval_T *rettv);
void f_term_getattr(typval_T *argvars, typval_T *rettv);
void f_term_getcursor(typval_T *argvars, typval_T *rettv);
void f_term_getjob(typval_T *argvars, typval_T *rettv);
void f_term_getline(typval_T *argvars, typval_T *rettv);
void f_term_getscrolled(typval_T *argvars, typval_T *rettv);
void f_term_getsize(typval_T *argvars, typval_T *rettv);
void f_term_setsize(typval_T *argvars, typval_T *rettv);
void f_term_getstatus(typval_T *argvars, typval_T *rettv);
void f_term_gettitle(typval_T *argvars, typval_T *rettv);
void f_term_gettty(typval_T *argvars, typval_T *rettv);
void f_term_list(typval_T *argvars, typval_T *rettv);
void f_term_scrape(typval_T *argvars, typval_T *rettv);
void f_term_sendkeys(typval_T *argvars, typval_T *rettv);
void f_term_getansicolors(typval_T *argvars, typval_T *rettv);
void f_term_setansicolors(typval_T *argvars, typval_T *rettv);
void f_term_setrestore(typval_T *argvars, typval_T *rettv);
void f_term_setkill(typval_T *argvars, typval_T *rettv);
+2 -1
View File
@@ -8735,7 +8735,8 @@ screen_fill(
if (row == Rows - 1) /* overwritten the command line */
{
redraw_cmdline = TRUE;
if (c1 == ' ' && c2 == ' ')
if (start_col == 0 && end_col == Columns
&& c1 == ' ' && c2 == ' ' && attr == 0)
clear_cmdline = FALSE; /* command line has been cleared */
if (start_col == 0)
mode_displayed = FALSE; /* mode cleared or overwritten */
+59 -7
View File
@@ -40,9 +40,6 @@
* TODO:
* - Win32: Make terminal used for :!cmd in the GUI work better. Allow for
* redirection. Probably in call to channel_set_pipes().
* - implement term_setsize()
* - add an optional limit for the scrollback size. When reaching it remove
* 10% at the start.
* - Copy text in the vterm to the Vim buffer once in a while, so that
* completion works.
* - in GUI vertical split causes problems. Cursor is flickering. (Hirohito
@@ -2061,6 +2058,11 @@ terminal_loop(int blocking)
/* "CTRL-W .": send CTRL-W to the job */
c = Ctrl_W;
}
else if (termkey == 0 && c == Ctrl_BSL)
{
/* "CTRL-W CTRL-\": send CTRL-\ to the job */
c = Ctrl_BSL;
}
else if (c == 'N')
{
/* CTRL-W N : go to Terminal-Normal mode. */
@@ -2178,7 +2180,7 @@ color2index(VTermColor *color, int fg, int *boldp)
case 2: return lookup_color( 4, fg, boldp) + 1; /* dark red */
case 3: return lookup_color( 2, fg, boldp) + 1; /* dark green */
case 4: return lookup_color( 6, fg, boldp) + 1; /* brown */
case 5: return lookup_color( 1, fg, boldp) + 1; /* dark blue*/
case 5: return lookup_color( 1, fg, boldp) + 1; /* dark blue */
case 6: return lookup_color( 5, fg, boldp) + 1; /* dark magenta */
case 7: return lookup_color( 3, fg, boldp) + 1; /* dark cyan */
case 8: return lookup_color( 8, fg, boldp) + 1; /* light grey */
@@ -2519,7 +2521,27 @@ handle_pushline(int cols, const VTermScreenCell *cells, void *user)
{
term_T *term = (term_T *)user;
/* TODO: Limit the number of lines that are stored. */
/* If the number of lines that are stored goes over 'termscrollback' then
* delete the first 10%. */
if (term->tl_scrollback.ga_len > p_tlsl)
{
int todo = p_tlsl / 10;
int i;
curbuf = term->tl_buffer;
for (i = 0; i < todo; ++i)
{
vim_free(((sb_line_T *)term->tl_scrollback.ga_data + i)->sb_cells);
ml_delete(1, FALSE);
}
curbuf = curwin->w_buffer;
term->tl_scrollback.ga_len -= todo;
mch_memmove(term->tl_scrollback.ga_data,
(sb_line_T *)term->tl_scrollback.ga_data + todo,
sizeof(sb_line_T) * term->tl_scrollback.ga_len);
}
if (ga_grow(&term->tl_scrollback, 1) == OK)
{
cellattr_T *p = NULL;
@@ -4602,6 +4624,36 @@ f_term_getsize(typval_T *argvars, typval_T *rettv)
list_append_number(l, buf->b_term->tl_cols);
}
/*
* "term_setsize(buf, rows, cols)" function
*/
void
f_term_setsize(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
buf_T *buf = term_get_buf(argvars, "term_setsize()");
term_T *term;
varnumber_T rows, cols;
if (buf == NULL)
{
EMSG(_("E955: Not a terminal buffer"));
return;
}
if (buf->b_term->tl_vterm == NULL)
return;
term = buf->b_term;
rows = get_tv_number(&argvars[1]);
rows = rows <= 0 ? term->tl_rows : rows;
cols = get_tv_number(&argvars[2]);
cols = cols <= 0 ? term->tl_cols : cols;
vterm_set_size(term->tl_vterm, rows, cols);
/* handle_resize() will resize the windows */
/* Get and remember the size we ended up with. Update the pty. */
vterm_get_size(term->tl_vterm, &term->tl_rows, &term->tl_cols);
term_report_winsize(term, term->tl_rows, term->tl_cols);
}
/*
* "term_getstatus(buf)" function
*/
@@ -5432,7 +5484,7 @@ term_free_vterm(term_T *term)
}
/*
* Request size to terminal.
* Report the size to the terminal.
*/
static void
term_report_winsize(term_T *term, int rows, int cols)
@@ -5514,7 +5566,7 @@ term_free_vterm(term_T *term)
}
/*
* Request size to terminal.
* Report the size to the terminal.
*/
static void
term_report_winsize(term_T *term, int rows, int cols)
+17
View File
@@ -25,3 +25,20 @@ func Test_nocatch_restore_silent_emsg()
let c5 = nr2char(screenchar(&lines, 5))
call assert_equal('wrong', c1 . c2 . c3 . c4 . c5)
endfunc
func Test_mkdir_p()
call mkdir('Xmkdir/nested', 'p')
call assert_true(isdirectory('Xmkdir/nested'))
try
" Trying to make existing directories doesn't error
call mkdir('Xmkdir', 'p')
call mkdir('Xmkdir/nested', 'p')
catch /E739:/
call assert_report('mkdir(..., "p") failed for an existing directory')
endtry
" 'p' doesn't suppress real errors
call writefile([], 'Xfile')
call assert_fails('call mkdir("Xfile", "p")', 'E739')
call delete('Xfile')
call delete('Xmkdir', 'rf')
endfunc
+33 -2
View File
@@ -271,6 +271,27 @@ func Test_terminal_scroll()
call delete('Xtext')
endfunc
func Test_terminal_scrollback()
let buf = Run_shell_in_terminal({})
set terminalscroll=100
call writefile(range(150), 'Xtext')
if has('win32')
call term_sendkeys(buf, "type Xtext\<CR>")
else
call term_sendkeys(buf, "cat Xtext\<CR>")
endif
let rows = term_getsize(buf)[0]
call WaitFor({-> term_getline(buf, rows - 1) =~ '149'})
let lines = line('$')
call assert_true(lines <= 100)
call assert_true(lines > 90)
call Stop_shell_in_terminal(buf)
call term_wait(buf)
exe buf . 'bwipe'
set terminalscroll&
endfunc
func Test_terminal_size()
let cmd = Get_cat_123_cmd()
@@ -286,9 +307,19 @@ func Test_terminal_size()
vsplit
exe 'terminal ++rows=5 ++cols=33 ' . cmd
let size = term_getsize('')
call assert_equal([5, 33], term_getsize(''))
call term_setsize('', 6, 0)
call assert_equal([6, 33], term_getsize(''))
call term_setsize('', 0, 35)
call assert_equal([6, 35], term_getsize(''))
call term_setsize('', 7, 30)
call assert_equal([7, 30], term_getsize(''))
bwipe!
call assert_equal([5, 33], size)
call assert_fails("call term_setsize('', 7, 30)", "E955:")
call term_start(cmd, {'term_rows': 6, 'term_cols': 36})
let size = term_getsize('')
+24
View File
@@ -483,4 +483,28 @@ func Test_access_freed_mem()
bwipe xxx
endfunc
func Test_visual_cleared_after_window_split()
new | only!
let smd_save = &showmode
set showmode
let ls_save = &laststatus
set laststatus=1
call setline(1, ['a', 'b', 'c', 'd', ''])
norm! G
exe "norm! kkvk"
redraw
exe "norm! \<C-W>v"
redraw
" check if '-- VISUAL --' disappeared from command line
let columns = range(1, &columns)
let cmdlinechars = map(columns, 'nr2char(screenchar(&lines, v:val))')
let cmdline = join(cmdlinechars, '')
let cmdline_ltrim = substitute(cmdline, '^\s*', "", "")
let mode_shown = substitute(cmdline_ltrim, '\s*$', "", "")
call assert_equal('', mode_shown)
let &showmode = smd_save
let &laststatus = ls_save
bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+20
View File
@@ -777,6 +777,26 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1714,
/**/
1713,
/**/
1712,
/**/
1711,
/**/
1710,
/**/
1709,
/**/
1708,
/**/
1707,
/**/
1706,
/**/
1705,
/**/
1704,
/**/
+8 -1
View File
@@ -778,6 +778,7 @@ win_split_ins(
int before;
int minheight;
int wmh1;
int did_set_fraction = FALSE;
if (flags & WSP_TOP)
oldwin = firstwin;
@@ -959,6 +960,11 @@ win_split_ins(
* instead, if possible. */
if (oldwin->w_p_wfh)
{
/* Set w_fraction now so that the cursor keeps the same relative
* vertical position using the old height. */
set_fraction(oldwin);
did_set_fraction = TRUE;
win_setheight_win(oldwin->w_height + new_size + STATUS_HEIGHT,
oldwin);
oldwin_height = oldwin->w_height;
@@ -1088,7 +1094,8 @@ win_split_ins(
/* Set w_fraction now so that the cursor keeps the same relative
* vertical position. */
set_fraction(oldwin);
if (!did_set_fraction)
set_fraction(oldwin);
wp->w_fraction = oldwin->w_fraction;
if (flags & WSP_VERT)