mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-07 15:37:14 +02:00
Merge remote-tracking branch 'vim/master'
This commit is contained in:
Vendored
+1
-1
@@ -12122,7 +12122,7 @@ for ac_func in bcmp fchdir fchown fsync getcwd getpseudotty \
|
||||
getpwent getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
|
||||
memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
|
||||
setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
|
||||
sigvec strcasecmp strerror strftime stricmp strncasecmp \
|
||||
sigprocmask sigvec strcasecmp strerror strftime stricmp strncasecmp \
|
||||
strnicmp strpbrk strtol tgetent towlower towupper iswupper \
|
||||
usleep utime utimes
|
||||
do :
|
||||
|
||||
@@ -190,6 +190,7 @@
|
||||
#undef HAVE_SIGSET
|
||||
#undef HAVE_SIGSETJMP
|
||||
#undef HAVE_SIGSTACK
|
||||
#undef HAVE_SIGPROCMASK
|
||||
#undef HAVE_SIGVEC
|
||||
#undef HAVE_SMACK
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
+1
-1
@@ -3677,7 +3677,7 @@ AC_CHECK_FUNCS(bcmp fchdir fchown fsync getcwd getpseudotty \
|
||||
getpwent getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
|
||||
memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
|
||||
setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
|
||||
sigvec strcasecmp strerror strftime stricmp strncasecmp \
|
||||
sigprocmask sigvec strcasecmp strerror strftime stricmp strncasecmp \
|
||||
strnicmp strpbrk strtol tgetent towlower towupper iswupper \
|
||||
usleep utime utimes)
|
||||
AC_FUNC_FSEEKO
|
||||
|
||||
+32
-30
@@ -1100,10 +1100,7 @@ ex_diffsplit(exarg_T *eap)
|
||||
if (bufref_valid(&old_curbuf))
|
||||
/* Move the cursor position to that of the old window. */
|
||||
curwin->w_cursor.lnum = diff_get_corresponding_line(
|
||||
old_curbuf.br_buf,
|
||||
old_curwin->w_cursor.lnum,
|
||||
curbuf,
|
||||
curwin->w_cursor.lnum);
|
||||
old_curbuf.br_buf, old_curwin->w_cursor.lnum);
|
||||
}
|
||||
/* Now that lines are folded scroll to show the cursor at the same
|
||||
* relative position. */
|
||||
@@ -2524,21 +2521,22 @@ diff_move_to(int dir, long count)
|
||||
return OK;
|
||||
}
|
||||
|
||||
linenr_T
|
||||
diff_get_corresponding_line(
|
||||
/*
|
||||
* Return the line number in the current window that is closest to "lnum1" in
|
||||
* "buf1" in diff mode.
|
||||
*/
|
||||
static linenr_T
|
||||
diff_get_corresponding_line_int(
|
||||
buf_T *buf1,
|
||||
linenr_T lnum1,
|
||||
buf_T *buf2,
|
||||
linenr_T lnum3)
|
||||
linenr_T lnum1)
|
||||
{
|
||||
int idx1;
|
||||
int idx2;
|
||||
diff_T *dp;
|
||||
int baseline = 0;
|
||||
linenr_T lnum2;
|
||||
|
||||
idx1 = diff_buf_idx(buf1);
|
||||
idx2 = diff_buf_idx(buf2);
|
||||
idx2 = diff_buf_idx(curbuf);
|
||||
if (idx1 == DB_COUNT || idx2 == DB_COUNT || curtab->tp_first_diff == NULL)
|
||||
return lnum1;
|
||||
|
||||
@@ -2551,15 +2549,8 @@ diff_get_corresponding_line(
|
||||
for (dp = curtab->tp_first_diff; dp != NULL; dp = dp->df_next)
|
||||
{
|
||||
if (dp->df_lnum[idx1] > lnum1)
|
||||
{
|
||||
lnum2 = lnum1 - baseline;
|
||||
/* don't end up past the end of the file */
|
||||
if (lnum2 > buf2->b_ml.ml_line_count)
|
||||
lnum2 = buf2->b_ml.ml_line_count;
|
||||
|
||||
return lnum2;
|
||||
}
|
||||
else if ((dp->df_lnum[idx1] + dp->df_count[idx1]) > lnum1)
|
||||
return lnum1 - baseline;
|
||||
if ((dp->df_lnum[idx1] + dp->df_count[idx1]) > lnum1)
|
||||
{
|
||||
/* Inside the diffblock */
|
||||
baseline = lnum1 - dp->df_lnum[idx1];
|
||||
@@ -2568,10 +2559,11 @@ diff_get_corresponding_line(
|
||||
|
||||
return dp->df_lnum[idx2] + baseline;
|
||||
}
|
||||
else if ( (dp->df_lnum[idx1] == lnum1)
|
||||
&& (dp->df_count[idx1] == 0)
|
||||
&& (dp->df_lnum[idx2] <= lnum3)
|
||||
&& ((dp->df_lnum[idx2] + dp->df_count[idx2]) > lnum3))
|
||||
if ( (dp->df_lnum[idx1] == lnum1)
|
||||
&& (dp->df_count[idx1] == 0)
|
||||
&& (dp->df_lnum[idx2] <= curwin->w_cursor.lnum)
|
||||
&& ((dp->df_lnum[idx2] + dp->df_count[idx2])
|
||||
> curwin->w_cursor.lnum))
|
||||
/*
|
||||
* Special case: if the cursor is just after a zero-count
|
||||
* block (i.e. all filler) and the target cursor is already
|
||||
@@ -2579,18 +2571,28 @@ diff_get_corresponding_line(
|
||||
* unmoved. This makes repeated CTRL-W W operations work
|
||||
* as expected.
|
||||
*/
|
||||
return lnum3;
|
||||
return curwin->w_cursor.lnum;
|
||||
baseline = (dp->df_lnum[idx1] + dp->df_count[idx1])
|
||||
- (dp->df_lnum[idx2] + dp->df_count[idx2]);
|
||||
}
|
||||
|
||||
/* If we get here then the cursor is after the last diff */
|
||||
lnum2 = lnum1 - baseline;
|
||||
/* don't end up past the end of the file */
|
||||
if (lnum2 > buf2->b_ml.ml_line_count)
|
||||
lnum2 = buf2->b_ml.ml_line_count;
|
||||
return lnum1 - baseline;
|
||||
}
|
||||
|
||||
return lnum2;
|
||||
/*
|
||||
* Return the line number in the current window that is closest to "lnum1" in
|
||||
* "buf1" in diff mode. Checks the line number to be valid.
|
||||
*/
|
||||
linenr_T
|
||||
diff_get_corresponding_line(buf_T *buf1, linenr_T lnum1)
|
||||
{
|
||||
linenr_T lnum = diff_get_corresponding_line_int(buf1, lnum1);
|
||||
|
||||
/* don't end up past the end of the file */
|
||||
if (lnum > curbuf->b_ml.ml_line_count)
|
||||
return curbuf->b_ml.ml_line_count;
|
||||
return lnum;
|
||||
}
|
||||
|
||||
#if defined(FEAT_FOLDING) || defined(PROTO)
|
||||
|
||||
+14
-5
@@ -4648,14 +4648,19 @@ ins_compl_get_exp(pos_T *ini)
|
||||
static void
|
||||
ins_compl_delete(void)
|
||||
{
|
||||
int i;
|
||||
int col;
|
||||
|
||||
/*
|
||||
* In insert mode: Delete the typed part.
|
||||
* In replace mode: Put the old characters back, if any.
|
||||
*/
|
||||
i = compl_col + (compl_cont_status & CONT_ADDING ? compl_length : 0);
|
||||
backspace_until_column(i);
|
||||
col = compl_col + (compl_cont_status & CONT_ADDING ? compl_length : 0);
|
||||
if ((int)curwin->w_cursor.col > col)
|
||||
{
|
||||
if (stop_arrow() == FAIL)
|
||||
return;
|
||||
backspace_until_column(col);
|
||||
}
|
||||
|
||||
/* TODO: is this sufficient for redrawing? Redrawing everything causes
|
||||
* flicker, thus we can't do that. */
|
||||
@@ -5073,8 +5078,11 @@ ins_complete(int c, int enable_pum)
|
||||
colnr_T curs_col; /* cursor column */
|
||||
int n;
|
||||
int save_w_wrow;
|
||||
int insert_match;
|
||||
|
||||
compl_direction = ins_compl_key2dir(c);
|
||||
insert_match = ins_compl_use_match(c);
|
||||
|
||||
if (!compl_started)
|
||||
{
|
||||
/* First time we hit ^N or ^P (in a row, I mean) */
|
||||
@@ -5500,6 +5508,8 @@ ins_complete(int c, int enable_pum)
|
||||
edit_submode_extra = NULL;
|
||||
out_flush();
|
||||
}
|
||||
else if (insert_match && stop_arrow() == FAIL)
|
||||
return FAIL;
|
||||
|
||||
compl_shown_match = compl_curr_match;
|
||||
compl_shows_dir = compl_direction;
|
||||
@@ -5508,8 +5518,7 @@ ins_complete(int c, int enable_pum)
|
||||
* Find next match (and following matches).
|
||||
*/
|
||||
save_w_wrow = curwin->w_wrow;
|
||||
n = ins_compl_next(TRUE, ins_compl_key2count(c),
|
||||
ins_compl_use_match(c), FALSE);
|
||||
n = ins_compl_next(TRUE, ins_compl_key2count(c), insert_match, FALSE);
|
||||
|
||||
/* may undisplay the popup menu */
|
||||
ins_compl_upd_pum();
|
||||
|
||||
+2
-5
@@ -2853,11 +2853,8 @@ do_check_cursorbind(void)
|
||||
{
|
||||
# ifdef FEAT_DIFF
|
||||
if (curwin->w_p_diff)
|
||||
curwin->w_cursor.lnum
|
||||
= diff_get_corresponding_line(old_curbuf,
|
||||
line,
|
||||
curbuf,
|
||||
curwin->w_cursor.lnum);
|
||||
curwin->w_cursor.lnum =
|
||||
diff_get_corresponding_line(old_curbuf, line);
|
||||
else
|
||||
# endif
|
||||
curwin->w_cursor.lnum = line;
|
||||
|
||||
+52
-4
@@ -211,6 +211,15 @@ static RETSIGTYPE deathtrap SIGPROTOARG;
|
||||
static void catch_int_signal(void);
|
||||
static void set_signals(void);
|
||||
static void catch_signals(RETSIGTYPE (*func_deadly)(), RETSIGTYPE (*func_other)());
|
||||
#ifdef HAVE_SIGPROCMASK
|
||||
# define SIGSET_DECL(set) sigset_t set;
|
||||
# define BLOCK_SIGNALS(set) block_signals(set)
|
||||
# define UNBLOCK_SIGNALS(set) unblock_signals(set)
|
||||
#else
|
||||
# define SIGSET_DECL(set)
|
||||
# define BLOCK_SIGNALS(set) do { /**/ } while (0)
|
||||
# define UNBLOCK_SIGNALS(set) do { /**/ } while (0)
|
||||
#endif
|
||||
static int have_wildcard(int, char_u **);
|
||||
static int have_dollars(int, char_u **);
|
||||
|
||||
@@ -1468,6 +1477,33 @@ catch_signals(
|
||||
signal(signal_info[i].sig, func_other);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SIGPROCMASK
|
||||
static void
|
||||
block_signals(sigset_t *set)
|
||||
{
|
||||
sigset_t newset;
|
||||
int i;
|
||||
|
||||
sigemptyset(&newset);
|
||||
|
||||
for (i = 0; signal_info[i].sig != -1; i++)
|
||||
sigaddset(&newset, signal_info[i].sig);
|
||||
|
||||
# if defined(_REENTRANT) && defined(SIGCONT)
|
||||
/* SIGCONT isn't in the list, because its default action is ignore */
|
||||
sigaddset(&newset, SIGCONT);
|
||||
# endif
|
||||
|
||||
sigprocmask(SIG_BLOCK, &newset, set);
|
||||
}
|
||||
|
||||
static void
|
||||
unblock_signals(sigset_t *set)
|
||||
{
|
||||
sigprocmask(SIG_SETMASK, set, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Handling of SIGHUP, SIGQUIT and SIGTERM:
|
||||
* "when" == a signal: when busy, postpone and return FALSE, otherwise
|
||||
@@ -4301,12 +4337,18 @@ mch_call_shell(
|
||||
|
||||
if (!pipe_error) /* pty or pipe opened or not used */
|
||||
{
|
||||
SIGSET_DECL(curset)
|
||||
|
||||
# ifdef __BEOS__
|
||||
beos_cleanup_read_thread();
|
||||
# endif
|
||||
|
||||
if ((pid = fork()) == -1) /* maybe we should use vfork() */
|
||||
BLOCK_SIGNALS(&curset);
|
||||
pid = fork(); /* maybe we should use vfork() */
|
||||
if (pid == -1)
|
||||
{
|
||||
UNBLOCK_SIGNALS(&curset);
|
||||
|
||||
MSG_PUTS(_("\nCannot fork\n"));
|
||||
if ((options & (SHELL_READ|SHELL_WRITE))
|
||||
# ifdef FEAT_GUI
|
||||
@@ -4333,6 +4375,7 @@ mch_call_shell(
|
||||
else if (pid == 0) /* child */
|
||||
{
|
||||
reset_signals(); /* handle signals normally */
|
||||
UNBLOCK_SIGNALS(&curset);
|
||||
|
||||
if (!show_shell_mess || (options & SHELL_EXPAND))
|
||||
{
|
||||
@@ -4476,6 +4519,7 @@ mch_call_shell(
|
||||
*/
|
||||
catch_signals(SIG_IGN, SIG_ERR);
|
||||
catch_int_signal();
|
||||
UNBLOCK_SIGNALS(&curset);
|
||||
|
||||
/*
|
||||
* For the GUI we redirect stdin, stdout and stderr to our window.
|
||||
@@ -5091,6 +5135,7 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED)
|
||||
int use_file_for_out = options->jo_io[PART_OUT] == JIO_FILE;
|
||||
int use_file_for_err = options->jo_io[PART_ERR] == JIO_FILE;
|
||||
int use_out_for_err = options->jo_io[PART_ERR] == JIO_OUT;
|
||||
SIGSET_DECL(curset)
|
||||
|
||||
if (use_out_for_err && use_null_for_out)
|
||||
use_null_for_err = TRUE;
|
||||
@@ -5162,13 +5207,14 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED)
|
||||
goto failed;
|
||||
}
|
||||
|
||||
BLOCK_SIGNALS(&curset);
|
||||
pid = fork(); /* maybe we should use vfork() */
|
||||
if (pid == -1)
|
||||
if (pid == -1)
|
||||
{
|
||||
/* failed to fork */
|
||||
UNBLOCK_SIGNALS(&curset);
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if (pid == 0)
|
||||
{
|
||||
int null_fd = -1;
|
||||
@@ -5176,6 +5222,7 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED)
|
||||
|
||||
/* child */
|
||||
reset_signals(); /* handle signals normally */
|
||||
UNBLOCK_SIGNALS(&curset);
|
||||
|
||||
# ifdef HAVE_SETSID
|
||||
/* Create our own process group, so that the child and all its
|
||||
@@ -5256,6 +5303,8 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED)
|
||||
}
|
||||
|
||||
/* parent */
|
||||
UNBLOCK_SIGNALS(&curset);
|
||||
|
||||
job->jv_pid = pid;
|
||||
job->jv_status = JOB_STARTED;
|
||||
job->jv_channel = channel; /* ch_refcount was set above */
|
||||
@@ -5379,7 +5428,6 @@ mch_detect_ended_job(job_T *job_list)
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
+1
-1
@@ -22,6 +22,6 @@ void nv_diffgetput(int put, long count);
|
||||
void ex_diffgetput(exarg_T *eap);
|
||||
int diff_mode_buf(buf_T *buf);
|
||||
int diff_move_to(int dir, long count);
|
||||
linenr_T diff_get_corresponding_line(buf_T *buf1, linenr_T lnum1, buf_T *buf2, linenr_T lnum3);
|
||||
linenr_T diff_get_corresponding_line(buf_T *buf1, linenr_T lnum1);
|
||||
linenr_T diff_lnum_win(linenr_T lnum, win_T *wp);
|
||||
/* vim: set ft=c : */
|
||||
|
||||
@@ -1433,6 +1433,21 @@ func Test_job_start_invalid()
|
||||
call assert_fails('call job_start("")', 'E474:')
|
||||
endfunc
|
||||
|
||||
func Test_job_stop_immediately()
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
|
||||
let job = job_start([s:python, '-c', 'import time;time.sleep(10)'])
|
||||
try
|
||||
call job_stop(job)
|
||||
call WaitFor('"dead" == job_status(job)')
|
||||
call assert_equal('dead', job_status(job))
|
||||
finally
|
||||
call job_stop(job, 'kill')
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
" This was leaking memory.
|
||||
func Test_partial_in_channel_cycle()
|
||||
let d = {}
|
||||
|
||||
@@ -218,3 +218,20 @@ func Test_diffoff()
|
||||
bwipe!
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_setting_cursor()
|
||||
new Xtest1
|
||||
put =range(1,90)
|
||||
wq
|
||||
new Xtest2
|
||||
put =range(1,100)
|
||||
wq
|
||||
|
||||
tabe Xtest2
|
||||
$
|
||||
diffsp Xtest1
|
||||
tabclose
|
||||
|
||||
call delete('Xtest1')
|
||||
call delete('Xtest2')
|
||||
endfunc
|
||||
|
||||
@@ -427,6 +427,11 @@ func Test_complete_no_undo()
|
||||
call feedkeys("u", 'xt')
|
||||
call assert_equal('bbb', getline(2))
|
||||
|
||||
call feedkeys("A\<Right>\<C-N>\<Esc>", 'xt')
|
||||
call assert_equal('January', getline(2))
|
||||
call feedkeys("u", 'xt')
|
||||
call assert_equal('bbb', getline(2))
|
||||
|
||||
iunmap <Right>
|
||||
set completeopt&
|
||||
q!
|
||||
|
||||
@@ -779,6 +779,12 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
45,
|
||||
/**/
|
||||
44,
|
||||
/**/
|
||||
43,
|
||||
/**/
|
||||
42,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user