Compare commits

...

7 Commits

Author SHA1 Message Date
ec0557f08b patch 8.0.1444: missing -D_FILE_OFFSET_BITS=64 may cause problems
Problem:    Missing -D_FILE_OFFSET_BITS=64 may cause problems if a library is
            compiled with it.
Solution:   Include -D_FILE_OFFSET_BITS if some CFLAGS has it. (James McCoy,
            closes #2600)
2018-01-31 14:41:37 +01:00
059fd01021 patch 8.0.1443: compiler complains about uninitialized variable
Problem:    Compiler complains about uninitialized variable. (Tony Mechelynck)
Solution:   Assign a value to the variable.
2018-01-31 14:25:53 +01:00
a172b63ab8 patch 8.0.1442: using pointer before it is set
Problem:    Using pointer before it is set.
Solution:   Search in whole buffer instead of next token.
2018-01-30 22:52:06 +01:00
ce46d934af patch 8.0.1441: using ":undo 0" leaves undo in wrong state
Problem:    Using ":undo 0" leaves undo in wrong state.
Solution:   Instead of searching for state 1 and go above, just use the start.
            (Ozaki Kiichi, closes #2595)
2018-01-30 22:46:06 +01:00
b50773c6df patch 8.0.1440: terminal window: some vterm responses are delayed
Problem:    Terminal window: some vterm responses are delayed.
Solution:   After writing input. check if there is output to read. (Ozaki
            Kiichi, closes #2594)
2018-01-30 22:31:19 +01:00
1274d33493 patch 8.0.1439: if cscope fails a search Vim may hang
Problem:    If cscope fails a search Vim may hang.
Solution:   Bail out when a search error is encountered. (Safouane Baroudi,
            closes #2598)
2018-01-30 21:47:52 +01:00
0479e910c4 patch 8.0.1438: filetype detection test not updated for change
Problem:    Filetype detection test not updated for change.
Solution:   Update the test.
2018-01-29 09:17:32 +01:00
10 changed files with 230 additions and 97 deletions

12
src/auto/configure vendored
View File

@ -14314,6 +14314,18 @@ $as_echo "no" >&6; }
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need to force -D_FILE_OFFSET_BITS=64" >&5
$as_echo_n "checking whether we need to force -D_FILE_OFFSET_BITS=64... " >&6; }
if echo "$CFLAGS $LUA_CFLAGS $MZSCHEME_CFLAGS $PERL_CFLAGS $PYTHON_GETPATH_CFLAGS $PYTHON_CFLAGS $PYTHON3_CFLAGS $TCL_CFLAGS $RUBY_CFLAGS $GTK_CFLAGS" | grep -q D_FILE_OFFSET_BITS 2>/dev/null; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define _FILE_OFFSET_BITS 64" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --as-needed support" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --as-needed support" >&5
$as_echo_n "checking linker --as-needed support... " >&6; } $as_echo_n "checking linker --as-needed support... " >&6; }
LINK_AS_NEEDED= LINK_AS_NEEDED=

View File

@ -4366,6 +4366,20 @@ if test "$GCC" = yes; then
fi fi
AC_SUBST(DEPEND_CFLAGS_FILTER) AC_SUBST(DEPEND_CFLAGS_FILTER)
dnl On some systems AC_SYS_LARGEFILE determines that -D_FILE_OFFSET_BITS=64
dnl isn't required, but the CFLAGS for some of the libraries we're using
dnl include the define. Since the define changes the size of some datatypes
dnl (e.g. ino_t and off_t), all of Vim's modules must be compiled with a
dnl consistent value. It's therefore safest to force the use of the define
dnl if it's present in any of the *_CFLAGS variables.
AC_MSG_CHECKING(whether we need to force -D_FILE_OFFSET_BITS=64)
if echo "$CFLAGS $LUA_CFLAGS $MZSCHEME_CFLAGS $PERL_CFLAGS $PYTHON_GETPATH_CFLAGS $PYTHON_CFLAGS $PYTHON3_CFLAGS $TCL_CFLAGS $RUBY_CFLAGS $GTK_CFLAGS" | grep -q D_FILE_OFFSET_BITS 2>/dev/null; then
AC_MSG_RESULT(yes)
AC_DEFINE(_FILE_OFFSET_BITS, 64)
else
AC_MSG_RESULT(no)
fi
dnl link.sh tries to avoid overlinking in a hackish way. dnl link.sh tries to avoid overlinking in a hackish way.
dnl At least GNU ld supports --as-needed which provides the same functionality dnl At least GNU ld supports --as-needed which provides the same functionality
dnl at linker level. Let's use it. dnl at linker level. Let's use it.

View File

@ -677,7 +677,7 @@ cs_cnt_matches(int idx)
{ {
char *stok; char *stok;
char *buf; char *buf;
int nlines; int nlines = 0;
buf = (char *)alloc(CSREAD_BUFSIZE); buf = (char *)alloc(CSREAD_BUFSIZE);
if (buf == NULL) if (buf == NULL)
@ -700,7 +700,10 @@ cs_cnt_matches(int idx)
* cscope will output error messages before the number-of-lines output. * cscope will output error messages before the number-of-lines output.
* Display/discard any output that doesn't match what we want. * Display/discard any output that doesn't match what we want.
* Accept "\S*cscope: X lines", also matches "mlcscope". * Accept "\S*cscope: X lines", also matches "mlcscope".
* Bail out for the "Unable to search" error.
*/ */
if (strstr((const char *)buf, "Unable to search database") != NULL)
break;
if ((stok = strtok(buf, (const char *)" ")) == NULL) if ((stok = strtok(buf, (const char *)" ")) == NULL)
continue; continue;
if (strstr((const char *)stok, "cscope:") == NULL) if (strstr((const char *)stok, "cscope:") == NULL)

View File

@ -649,6 +649,29 @@ free_terminal(buf_T *buf)
in_terminal_loop = NULL; in_terminal_loop = NULL;
} }
/*
* Get the part that is connected to the tty. Normally this is PART_IN, but
* when writing buffer lines to the job it can be another. This makes it
* possible to do "1,5term vim -".
*/
static ch_part_T
get_tty_part(term_T *term)
{
#ifdef UNIX
ch_part_T parts[3] = {PART_IN, PART_OUT, PART_ERR};
int i;
for (i = 0; i < 3; ++i)
{
int fd = term->tl_job->jv_channel->ch_part[parts[i]].ch_fd;
if (isatty(fd))
return parts[i];
}
#endif
return PART_IN;
}
/* /*
* Write job output "msg[len]" to the vterm. * Write job output "msg[len]" to the vterm.
*/ */
@ -656,9 +679,21 @@ free_terminal(buf_T *buf)
term_write_job_output(term_T *term, char_u *msg, size_t len) term_write_job_output(term_T *term, char_u *msg, size_t len)
{ {
VTerm *vterm = term->tl_vterm; VTerm *vterm = term->tl_vterm;
size_t prevlen = vterm_output_get_buffer_current(vterm);
vterm_input_write(vterm, (char *)msg, len); vterm_input_write(vterm, (char *)msg, len);
/* flush vterm buffer when vterm responded to control sequence */
if (prevlen != vterm_output_get_buffer_current(vterm))
{
char buf[KEY_BUF_LEN];
size_t curlen = vterm_output_read(vterm, buf, KEY_BUF_LEN);
if (curlen > 0)
channel_send(term->tl_job->jv_channel, get_tty_part(term),
(char_u *)buf, (int)curlen, NULL);
}
/* this invokes the damage callbacks */ /* this invokes the damage callbacks */
vterm_screen_flush_damage(vterm_obtain_screen(vterm)); vterm_screen_flush_damage(vterm_obtain_screen(vterm));
} }
@ -1238,29 +1273,6 @@ term_vgetc()
return c; return c;
} }
/*
* Get the part that is connected to the tty. Normally this is PART_IN, but
* when writing buffer lines to the job it can be another. This makes it
* possible to do "1,5term vim -".
*/
static ch_part_T
get_tty_part(term_T *term)
{
#ifdef UNIX
ch_part_T parts[3] = {PART_IN, PART_OUT, PART_ERR};
int i;
for (i = 0; i < 3; ++i)
{
int fd = term->tl_job->jv_channel->ch_part[parts[i]].ch_fd;
if (isatty(fd))
return parts[i];
}
#endif
return PART_IN;
}
/* /*
* Send keys to terminal. * Send keys to terminal.
* Return FAIL when the key needs to be handled in Normal mode. * Return FAIL when the key needs to be handled in Normal mode.

View File

@ -323,7 +323,9 @@ let s:filename_checks = {
\ 'pf': ['pf.conf'], \ 'pf': ['pf.conf'],
\ 'pfmain': ['main.cf'], \ 'pfmain': ['main.cf'],
\ 'php': ['file.php', 'file.php9', 'file.phtml', 'file.ctp'], \ 'php': ['file.php', 'file.php9', 'file.phtml', 'file.ctp'],
\ 'pike': ['file.pike', 'file.lpc', 'file.ulpc', 'file.pmod'], \ 'lpc': ['file.lpc', 'file.ulpc'],
\ 'pike': ['file.pike', 'file.pmod'],
\ 'cmod': ['file.cmod'],
\ 'pilrc': ['file.rcp'], \ 'pilrc': ['file.rcp'],
\ 'pine': ['.pinerc', 'pinerc', '.pinercex', 'pinercex'], \ 'pine': ['.pinerc', 'pinerc', '.pinercex', 'pinercex'],
\ 'pinfo': ['/etc/pinforc', '/.pinforc'], \ 'pinfo': ['/etc/pinforc', '/.pinforc'],

View File

@ -619,6 +619,8 @@ func Test_search_cmdline_incsearch_highlight_attr()
let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3}) let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3})
call WaitFor({-> lines == [term_getline(buf, 1), term_getline(buf, 2)] }) call WaitFor({-> lines == [term_getline(buf, 1), term_getline(buf, 2)] })
" wait for vim to complete initialization
call term_wait(buf)
" Get attr of normal(a0), incsearch(a1), hlsearch(a2) highlight " Get attr of normal(a0), incsearch(a1), hlsearch(a2) highlight
call term_sendkeys(buf, ":set incsearch hlsearch\<cr>") call term_sendkeys(buf, ":set incsearch hlsearch\<cr>")

View File

@ -806,3 +806,26 @@ func Test_terminal_term_start_empty_command()
let cmd = "call term_start(0, {'curwin' : 1, 'term_finish' : 'close'})" let cmd = "call term_start(0, {'curwin' : 1, 'term_finish' : 'close'})"
call assert_fails(cmd, 'E474') call assert_fails(cmd, 'E474')
endfunc endfunc
func Test_terminal_response_to_control_sequence()
if !has('unix')
return
endif
let buf = Run_shell_in_terminal({})
call term_wait(buf)
call term_sendkeys(buf, s:python . " -c 'import sys;sys.stdout.write(\"\\x1b[6n\")'\<cr>")
" wait for the response of control sequence from libvterm (and send it to tty)
call term_wait(buf, 100)
" wait for output from tty to display
call term_wait(buf)
call assert_match(';\d\+R', term_getline(buf, 2))
call term_sendkeys(buf, "\<c-c>")
call term_wait(buf)
call Stop_shell_in_terminal(buf)
exe buf . 'bwipe'
unlet g:job
endfunc

View File

@ -359,3 +359,47 @@ func Test_undo_append()
norm o norm o
quit quit
endfunc endfunc
func Test_undo_0()
new
set ul=100
normal i1
undo
normal i2
undo
normal i3
undo 0
let d = undotree()
call assert_equal('', getline(1))
call assert_equal(0, d.seq_cur)
redo
let d = undotree()
call assert_equal('3', getline(1))
call assert_equal(3, d.seq_cur)
undo 2
undo 0
let d = undotree()
call assert_equal('', getline(1))
call assert_equal(0, d.seq_cur)
redo
let d = undotree()
call assert_equal('2', getline(1))
call assert_equal(2, d.seq_cur)
undo 1
undo 0
let d = undotree()
call assert_equal('', getline(1))
call assert_equal(0, d.seq_cur)
redo
let d = undotree()
call assert_equal('1', getline(1))
call assert_equal(1, d.seq_cur)
bwipe!
endfunc

View File

@ -2272,7 +2272,7 @@ undo_time(
long closest_start; long closest_start;
long closest_seq = 0; long closest_seq = 0;
long val; long val;
u_header_T *uhp; u_header_T *uhp = NULL;
u_header_T *last; u_header_T *last;
int mark; int mark;
int nomark; int nomark;
@ -2295,14 +2295,7 @@ undo_time(
* Init "closest" to a value we can't reach. */ * Init "closest" to a value we can't reach. */
if (absolute) if (absolute)
{ {
if (step == 0) target = step;
{
/* target 0 does not exist, got to 1 and above it. */
target = 1;
above = TRUE;
}
else
target = step;
closest = -1; closest = -1;
} }
else else
@ -2369,6 +2362,13 @@ undo_time(
closest_start = closest; closest_start = closest;
closest_seq = curbuf->b_u_seq_cur; closest_seq = curbuf->b_u_seq_cur;
/* When "target" is 0; Back to origin. */
if (target == 0)
{
mark = lastmark; /* avoid that GCC complains */
goto target_zero;
}
/* /*
* May do this twice: * May do this twice:
* 1. Search for "target", update "closest" to the best match found. * 1. Search for "target", update "closest" to the best match found.
@ -2494,8 +2494,9 @@ undo_time(
above = TRUE; /* stop above the header */ above = TRUE; /* stop above the header */
} }
target_zero:
/* If we found it: Follow the path to go to where we want to be. */ /* If we found it: Follow the path to go to where we want to be. */
if (uhp != NULL) if (uhp != NULL || target == 0)
{ {
/* /*
* First go up the tree as much as needed. * First go up the tree as much as needed.
@ -2510,87 +2511,93 @@ undo_time(
uhp = curbuf->b_u_newhead; uhp = curbuf->b_u_newhead;
else else
uhp = uhp->uh_next.ptr; uhp = uhp->uh_next.ptr;
if (uhp == NULL || uhp->uh_walk != mark if (uhp == NULL || (target > 0 && uhp->uh_walk != mark)
|| (uhp->uh_seq == target && !above)) || (uhp->uh_seq == target && !above))
break; break;
curbuf->b_u_curhead = uhp; curbuf->b_u_curhead = uhp;
u_undoredo(TRUE); u_undoredo(TRUE);
uhp->uh_walk = nomark; /* don't go back down here */ if (target > 0)
uhp->uh_walk = nomark; /* don't go back down here */
} }
/* /* When back to origin, redo is not needed. */
* And now go down the tree (redo), branching off where needed. if (target > 0)
*/
while (!got_int)
{ {
/* Do the change warning now, for the same reason as above. */ /*
change_warning(0); * And now go down the tree (redo), branching off where needed.
*/
while (!got_int)
{
/* Do the change warning now, for the same reason as above. */
change_warning(0);
uhp = curbuf->b_u_curhead; uhp = curbuf->b_u_curhead;
if (uhp == NULL) if (uhp == NULL)
break; break;
/* Go back to the first branch with a mark. */ /* Go back to the first branch with a mark. */
while (uhp->uh_alt_prev.ptr != NULL while (uhp->uh_alt_prev.ptr != NULL
&& uhp->uh_alt_prev.ptr->uh_walk == mark) && uhp->uh_alt_prev.ptr->uh_walk == mark)
uhp = uhp->uh_alt_prev.ptr;
/* Find the last branch with a mark, that's the one. */
last = uhp;
while (last->uh_alt_next.ptr != NULL
&& last->uh_alt_next.ptr->uh_walk == mark)
last = last->uh_alt_next.ptr;
if (last != uhp)
{
/* Make the used branch the first entry in the list of
* alternatives to make "u" and CTRL-R take this branch. */
while (uhp->uh_alt_prev.ptr != NULL)
uhp = uhp->uh_alt_prev.ptr; uhp = uhp->uh_alt_prev.ptr;
if (last->uh_alt_next.ptr != NULL)
last->uh_alt_next.ptr->uh_alt_prev.ptr = /* Find the last branch with a mark, that's the one. */
last = uhp;
while (last->uh_alt_next.ptr != NULL
&& last->uh_alt_next.ptr->uh_walk == mark)
last = last->uh_alt_next.ptr;
if (last != uhp)
{
/* Make the used branch the first entry in the list of
* alternatives to make "u" and CTRL-R take this branch. */
while (uhp->uh_alt_prev.ptr != NULL)
uhp = uhp->uh_alt_prev.ptr;
if (last->uh_alt_next.ptr != NULL)
last->uh_alt_next.ptr->uh_alt_prev.ptr =
last->uh_alt_prev.ptr; last->uh_alt_prev.ptr;
last->uh_alt_prev.ptr->uh_alt_next.ptr = last->uh_alt_next.ptr; last->uh_alt_prev.ptr->uh_alt_next.ptr =
last->uh_alt_prev.ptr = NULL; last->uh_alt_next.ptr;
last->uh_alt_next.ptr = uhp; last->uh_alt_prev.ptr = NULL;
uhp->uh_alt_prev.ptr = last; last->uh_alt_next.ptr = uhp;
uhp->uh_alt_prev.ptr = last;
if (curbuf->b_u_oldhead == uhp) if (curbuf->b_u_oldhead == uhp)
curbuf->b_u_oldhead = last; curbuf->b_u_oldhead = last;
uhp = last; uhp = last;
if (uhp->uh_next.ptr != NULL) if (uhp->uh_next.ptr != NULL)
uhp->uh_next.ptr->uh_prev.ptr = uhp; uhp->uh_next.ptr->uh_prev.ptr = uhp;
} }
curbuf->b_u_curhead = uhp; curbuf->b_u_curhead = uhp;
if (uhp->uh_walk != mark) if (uhp->uh_walk != mark)
break; /* must have reached the target */ break; /* must have reached the target */
/* Stop when going backwards in time and didn't find the exact /* Stop when going backwards in time and didn't find the exact
* header we were looking for. */ * header we were looking for. */
if (uhp->uh_seq == target && above) if (uhp->uh_seq == target && above)
{ {
curbuf->b_u_seq_cur = target - 1; curbuf->b_u_seq_cur = target - 1;
break; break;
} }
u_undoredo(FALSE); u_undoredo(FALSE);
/* Advance "curhead" to below the header we last used. If it /* Advance "curhead" to below the header we last used. If it
* becomes NULL then we need to set "newhead" to this leaf. */ * becomes NULL then we need to set "newhead" to this leaf. */
if (uhp->uh_prev.ptr == NULL) if (uhp->uh_prev.ptr == NULL)
curbuf->b_u_newhead = uhp; curbuf->b_u_newhead = uhp;
curbuf->b_u_curhead = uhp->uh_prev.ptr; curbuf->b_u_curhead = uhp->uh_prev.ptr;
did_undo = FALSE; did_undo = FALSE;
if (uhp->uh_seq == target) /* found it! */ if (uhp->uh_seq == target) /* found it! */
break; break;
uhp = uhp->uh_prev.ptr; uhp = uhp->uh_prev.ptr;
if (uhp == NULL || uhp->uh_walk != mark) if (uhp == NULL || uhp->uh_walk != mark)
{ {
/* Need to redo more but can't find it... */ /* Need to redo more but can't find it... */
internal_error("undo_time()"); internal_error("undo_time()");
break; break;
}
} }
} }
} }

View File

@ -771,6 +771,20 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1444,
/**/
1443,
/**/
1442,
/**/
1441,
/**/
1440,
/**/
1439,
/**/
1438,
/**/ /**/
1437, 1437,
/**/ /**/