Skip to content

Commit c8aa5fb

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents c233aed + 19a3d68 commit c8aa5fb

File tree

11 files changed

+622
-19
lines changed

11 files changed

+622
-19
lines changed

src/channel.c

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3985,14 +3985,16 @@ ch_raw_common(typval_T *argvars, typval_T *rettv, int eval)
39853985
free_job_options(&opt);
39863986
}
39873987

3988+
# define KEEP_OPEN_TIME 20 /* msec */
3989+
39883990
# if (defined(UNIX) && !defined(HAVE_SELECT)) || defined(PROTO)
39893991
/*
39903992
* Add open channels to the poll struct.
39913993
* Return the adjusted struct index.
39923994
* The type of "fds" is hidden to avoid problems with the function proto.
39933995
*/
39943996
int
3995-
channel_poll_setup(int nfd_in, void *fds_in)
3997+
channel_poll_setup(int nfd_in, void *fds_in, int *towait)
39963998
{
39973999
int nfd = nfd_in;
39984000
channel_T *channel;
@@ -4007,10 +4009,21 @@ channel_poll_setup(int nfd_in, void *fds_in)
40074009

40084010
if (ch_part->ch_fd != INVALID_FD)
40094011
{
4010-
ch_part->ch_poll_idx = nfd;
4011-
fds[nfd].fd = ch_part->ch_fd;
4012-
fds[nfd].events = POLLIN;
4013-
nfd++;
4012+
if (channel->ch_keep_open)
4013+
{
4014+
/* For unknown reason poll() returns immediately for a
4015+
* keep-open channel. Instead of adding it to the fds add
4016+
* a short timeout and check, like polling. */
4017+
if (*towait < 0 || *towait > KEEP_OPEN_TIME)
4018+
*towait = KEEP_OPEN_TIME;
4019+
}
4020+
else
4021+
{
4022+
ch_part->ch_poll_idx = nfd;
4023+
fds[nfd].fd = ch_part->ch_fd;
4024+
fds[nfd].events = POLLIN;
4025+
nfd++;
4026+
}
40144027
}
40154028
else
40164029
channel->ch_part[part].ch_poll_idx = -1;
@@ -4046,6 +4059,12 @@ channel_poll_check(int ret_in, void *fds_in)
40464059
channel_read(channel, part, "channel_poll_check");
40474060
--ret;
40484061
}
4062+
else if (channel->ch_part[part].ch_fd != INVALID_FD
4063+
&& channel->ch_keep_open)
4064+
{
4065+
/* polling a keep-open channel */
4066+
channel_read(channel, part, "channel_poll_check_keep_open");
4067+
}
40494068
}
40504069

40514070
in_part = &channel->ch_part[PART_IN];
@@ -4062,11 +4081,17 @@ channel_poll_check(int ret_in, void *fds_in)
40624081
# endif /* UNIX && !HAVE_SELECT */
40634082

40644083
# if (!defined(WIN32) && defined(HAVE_SELECT)) || defined(PROTO)
4084+
40654085
/*
40664086
* The "fd_set" type is hidden to avoid problems with the function proto.
40674087
*/
40684088
int
4069-
channel_select_setup(int maxfd_in, void *rfds_in, void *wfds_in)
4089+
channel_select_setup(
4090+
int maxfd_in,
4091+
void *rfds_in,
4092+
void *wfds_in,
4093+
struct timeval *tv,
4094+
struct timeval **tvp)
40704095
{
40714096
int maxfd = maxfd_in;
40724097
channel_T *channel;
@@ -4082,9 +4107,25 @@ channel_select_setup(int maxfd_in, void *rfds_in, void *wfds_in)
40824107

40834108
if (fd != INVALID_FD)
40844109
{
4085-
FD_SET((int)fd, rfds);
4086-
if (maxfd < (int)fd)
4087-
maxfd = (int)fd;
4110+
if (channel->ch_keep_open)
4111+
{
4112+
/* For unknown reason select() returns immediately for a
4113+
* keep-open channel. Instead of adding it to the rfds add
4114+
* a short timeout and check, like polling. */
4115+
if (*tvp == NULL || tv->tv_sec > 0
4116+
|| tv->tv_usec > KEEP_OPEN_TIME * 1000)
4117+
{
4118+
*tvp = tv;
4119+
tv->tv_sec = 0;
4120+
tv->tv_usec = KEEP_OPEN_TIME * 1000;
4121+
}
4122+
}
4123+
else
4124+
{
4125+
FD_SET((int)fd, rfds);
4126+
if (maxfd < (int)fd)
4127+
maxfd = (int)fd;
4128+
}
40884129
}
40894130
}
40904131
}
@@ -4119,6 +4160,11 @@ channel_select_check(int ret_in, void *rfds_in, void *wfds_in)
41194160
FD_CLR(fd, rfds);
41204161
--ret;
41214162
}
4163+
else if (fd != INVALID_FD && channel->ch_keep_open)
4164+
{
4165+
/* polling a keep-open channel */
4166+
channel_read(channel, part, "channel_select_check_keep_open");
4167+
}
41224168
}
41234169

41244170
in_part = &channel->ch_part[PART_IN];

src/eval.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,7 +1704,10 @@ ex_let_one(
17041704
&stringval, opt_flags);
17051705
if ((opt_type == 1 && *op == '.')
17061706
|| (opt_type == 0 && *op != '.'))
1707+
{
17071708
EMSG2(_(e_letwrong), op);
1709+
s = NULL; /* don't set the value */
1710+
}
17081711
else
17091712
{
17101713
if (opt_type == 1) /* number */

src/os_unix.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5352,6 +5352,9 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options)
53525352
channel = add_channel();
53535353
if (channel == NULL)
53545354
goto failed;
5355+
if (job->jv_tty_out != NULL)
5356+
ch_log(channel, "using pty %s on fd %d",
5357+
job->jv_tty_out, pty_master_fd);
53555358
}
53565359

53575360
BLOCK_SIGNALS(&curset);
@@ -5724,6 +5727,9 @@ mch_create_pty_channel(job_T *job, jobopt_T *options)
57245727
close(pty_master_fd);
57255728
return FAIL;
57265729
}
5730+
if (job->jv_tty_out != NULL)
5731+
ch_log(channel, "using pty %s on fd %d",
5732+
job->jv_tty_out, pty_master_fd);
57275733
job->jv_channel = channel; /* ch_refcount was set by add_channel() */
57285734
channel->ch_keep_open = TRUE;
57295735

@@ -5991,7 +5997,7 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted)
59915997
}
59925998
# endif
59935999
#ifdef FEAT_JOB_CHANNEL
5994-
nfd = channel_poll_setup(nfd, &fds);
6000+
nfd = channel_poll_setup(nfd, &fds, &towait);
59956001
#endif
59966002
if (interrupted != NULL)
59976003
*interrupted = FALSE;
@@ -6043,7 +6049,8 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted)
60436049
}
60446050
# endif
60456051
#ifdef FEAT_JOB_CHANNEL
6046-
if (ret > 0)
6052+
/* also call when ret == 0, we may be polling a keep-open channel */
6053+
if (ret >= 0)
60476054
ret = channel_poll_check(ret, &fds);
60486055
#endif
60496056

@@ -6119,7 +6126,7 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted)
61196126
}
61206127
# endif
61216128
# ifdef FEAT_JOB_CHANNEL
6122-
maxfd = channel_select_setup(maxfd, &rfds, &wfds);
6129+
maxfd = channel_select_setup(maxfd, &rfds, &wfds, &tv, &tvp);
61236130
# endif
61246131
if (interrupted != NULL)
61256132
*interrupted = FALSE;
@@ -6205,7 +6212,8 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted)
62056212
}
62066213
# endif
62076214
#ifdef FEAT_JOB_CHANNEL
6208-
if (ret > 0)
6215+
/* also call when ret == 0, we may be polling a keep-open channel */
6216+
if (ret >= 0)
62096217
ret = channel_select_check(ret, &rfds, &wfds);
62106218
#endif
62116219

src/proto/channel.pro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ void channel_set_nonblock(channel_T *channel, ch_part_T part);
4040
int channel_send(channel_T *channel, ch_part_T part, char_u *buf_arg, int len_arg, char *fun);
4141
void ch_expr_common(typval_T *argvars, typval_T *rettv, int eval);
4242
void ch_raw_common(typval_T *argvars, typval_T *rettv, int eval);
43-
int channel_poll_setup(int nfd_in, void *fds_in);
43+
int channel_poll_setup(int nfd_in, void *fds_in, int *towait);
4444
int channel_poll_check(int ret_in, void *fds_in);
45-
int channel_select_setup(int maxfd_in, void *rfds_in, void *wfds_in);
45+
int channel_select_setup(int maxfd_in, void *rfds_in, void *wfds_in, struct timeval *tv, struct timeval **tvp);
4646
int channel_select_check(int ret_in, void *rfds_in, void *wfds_in);
4747
int channel_parse_messages(void);
4848
int channel_any_readahead(void);

src/screen.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4168,6 +4168,10 @@ win_line(
41684168
if (shl != &search_hl && cur != NULL)
41694169
cur = cur->next;
41704170
}
4171+
/* Only highlight one character after the last column. */
4172+
if (*ptr == NUL && (did_line_attr >= 1
4173+
|| (wp->w_p_list && lcs_eol_one == -1)))
4174+
search_attr = 0;
41714175
}
41724176
#endif
41734177

@@ -5064,7 +5068,9 @@ win_line(
50645068
++did_line_attr;
50655069

50665070
/* don't do search HL for the rest of the line */
5067-
if (line_attr != 0 && char_attr == search_attr && col > 0)
5071+
if (line_attr != 0 && char_attr == search_attr
5072+
&& (did_line_attr > 1
5073+
|| (wp->w_p_list && lcs_eol > 0)))
50685074
char_attr = line_attr;
50695075
# ifdef FEAT_DIFF
50705076
if (diff_hlf == HLF_TXD)
@@ -5324,6 +5330,13 @@ win_line(
53245330
#ifdef FEAT_SEARCH_EXTRA
53255331
/* highlight 'hlsearch' match at end of line */
53265332
|| (prevcol_hl_flag == TRUE
5333+
# ifdef FEAT_SYN_HL
5334+
&& !(wp->w_p_cul && lnum == wp->w_cursor.lnum
5335+
&& !(wp == curwin && VIsual_active))
5336+
# endif
5337+
# ifdef FEAT_DIFF
5338+
&& diff_hlf == (hlf_T)0
5339+
# endif
53275340
# if defined(LINE_ATTR)
53285341
&& did_line_attr <= 1
53295342
# endif

src/terminal.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
* - GUI: when 'confirm' is set and trying to exit Vim, dialog offers to save
5757
* changes to "!shell".
5858
* (justrajdeep, 2017 Aug 22)
59+
* - Redrawing is slow with Athena and Motif.
5960
* - For the GUI fill termios with default values, perhaps like pangoterm:
6061
* http://bazaar.launchpad.net/~leonerd/pangoterm/trunk/view/head:/main.c#L134
6162
* - if the job in the terminal does not support the mouse, we can use the
@@ -2243,6 +2244,12 @@ term_update_window(win_T *wp)
22432244
screen = vterm_obtain_screen(vterm);
22442245
state = vterm_obtain_state(vterm);
22452246

2247+
if (wp->w_redr_type >= NOT_VALID)
2248+
{
2249+
term->tl_dirty_row_start = 0;
2250+
term->tl_dirty_row_end = MAX_ROW;
2251+
}
2252+
22462253
/*
22472254
* If the window was resized a redraw will be triggered and we get here.
22482255
* Adjust the size of the vterm unless 'termsize' specifies a fixed size.

src/testdir/test_assign.vim

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,17 @@ func Test_let_termcap()
2929
let &t_xx = ""
3030
call assert_fails('let x = &t_xx', 'E15')
3131
endfunc
32+
33+
func Test_let_option_error()
34+
let _w = &tw
35+
let &tw = 80
36+
call assert_fails('let &tw .= 1', 'E734')
37+
call assert_equal(80, &tw)
38+
let &tw = _w
39+
40+
let _w = &fillchars
41+
let &fillchars = "vert:|"
42+
call assert_fails('let &fillchars += "diff:-"', 'E734')
43+
call assert_equal("vert:|", &fillchars)
44+
let &fillchars = _w
45+
endfunc

0 commit comments

Comments
 (0)