Skip to content

Commit 7e22007

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 914e85a + 2588b5a commit 7e22007

15 files changed

Lines changed: 309 additions & 29 deletions

src/channel.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,8 +1065,11 @@ invoke_callback(channel_T *channel, char_u *callback, typval_T *argv)
10651065
cursor_on();
10661066
out_flush();
10671067
#ifdef FEAT_GUI
1068-
gui_update_cursor(TRUE, FALSE);
1069-
gui_mch_flush();
1068+
if (gui.in_use)
1069+
{
1070+
gui_update_cursor(TRUE, FALSE);
1071+
gui_mch_flush();
1072+
}
10701073
#endif
10711074
}
10721075

@@ -1499,15 +1502,18 @@ may_invoke_callback(channel_T *channel, int part)
14991502
int seq_nr = -1;
15001503
ch_mode_T ch_mode = channel->ch_part[part].ch_mode;
15011504
cbq_T *cbhead = &channel->ch_part[part].ch_cb_head;
1502-
cbq_T *cbitem = cbhead->cq_next;
1505+
cbq_T *cbitem;
15031506
char_u *callback = NULL;
15041507
buf_T *buffer = NULL;
15051508

15061509
if (channel->ch_nb_close_cb != NULL)
15071510
/* this channel is handled elsewhere (netbeans) */
15081511
return FALSE;
15091512

1510-
/* use a message-specific callback, part callback or channel callback */
1513+
/* Use a message-specific callback, part callback or channel callback */
1514+
for (cbitem = cbhead->cq_next; cbitem != NULL; cbitem = cbitem->cq_next)
1515+
if (cbitem->cq_seq_nr == 0)
1516+
break;
15111517
if (cbitem != NULL)
15121518
callback = cbitem->cq_callback;
15131519
else if (channel->ch_part[part].ch_callback != NULL)
@@ -1629,16 +1635,13 @@ may_invoke_callback(channel_T *channel, int part)
16291635
int done = FALSE;
16301636

16311637
/* invoke the one-time callback with the matching nr */
1632-
while (cbitem != NULL)
1633-
{
1638+
for (cbitem = cbhead->cq_next; cbitem != NULL; cbitem = cbitem->cq_next)
16341639
if (cbitem->cq_seq_nr == seq_nr)
16351640
{
16361641
invoke_one_time_callback(channel, cbhead, cbitem, argv);
16371642
done = TRUE;
16381643
break;
16391644
}
1640-
cbitem = cbitem->cq_next;
1641-
}
16421645
if (!done)
16431646
ch_logn(channel, "Dropping message %d without callback", seq_nr);
16441647
}

src/ex_docmd.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4208,6 +4208,11 @@ set_one_cmd_context(
42084208
xp->xp_pattern = arg;
42094209
break;
42104210

4211+
case CMD_packadd:
4212+
xp->xp_context = EXPAND_PACKADD;
4213+
xp->xp_pattern = arg;
4214+
break;
4215+
42114216
#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
42124217
&& (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
42134218
case CMD_language:
@@ -5863,6 +5868,7 @@ static struct
58635868
{EXPAND_SYNTIME, "syntime"},
58645869
#endif
58655870
{EXPAND_SETTINGS, "option"},
5871+
{EXPAND_PACKADD, "packadd"},
58665872
{EXPAND_SHELLCMD, "shellcmd"},
58675873
#if defined(FEAT_SIGNS)
58685874
{EXPAND_SIGN, "sign"},

src/ex_getln.c

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ static int expand_showtail(expand_T *xp);
112112
#ifdef FEAT_CMDL_COMPL
113113
static int expand_shellcmd(char_u *filepat, int *num_file, char_u ***file, int flagsarg);
114114
static int ExpandRTDir(char_u *pat, int *num_file, char_u ***file, char *dirname[]);
115+
static int ExpandPackAddDir(char_u *pat, int *num_file, char_u ***file);
115116
# ifdef FEAT_CMDHIST
116117
static char_u *get_history_arg(expand_T *xp, int idx);
117118
# endif
@@ -4242,6 +4243,7 @@ addstar(
42424243
|| context == EXPAND_COMPILER
42434244
|| context == EXPAND_OWNSYNTAX
42444245
|| context == EXPAND_FILETYPE
4246+
|| context == EXPAND_PACKADD
42454247
|| (context == EXPAND_TAGS && fname[0] == '/'))
42464248
retval = vim_strnsave(fname, len);
42474249
else
@@ -4658,6 +4660,8 @@ ExpandFromContext(
46584660
if (xp->xp_context == EXPAND_USER_LIST)
46594661
return ExpandUserList(xp, num_file, file);
46604662
# endif
4663+
if (xp->xp_context == EXPAND_PACKADD)
4664+
return ExpandPackAddDir(pat, num_file, file);
46614665

46624666
regmatch.regprog = vim_regcomp(pat, p_magic ? RE_MAGIC : 0);
46634667
if (regmatch.regprog == NULL)
@@ -5194,6 +5198,58 @@ ExpandRTDir(
51945198
return OK;
51955199
}
51965200

5201+
/*
5202+
* Expand loadplugin names:
5203+
* 'packpath'/pack/ * /opt/{pat}
5204+
*/
5205+
static int
5206+
ExpandPackAddDir(
5207+
char_u *pat,
5208+
int *num_file,
5209+
char_u ***file)
5210+
{
5211+
char_u *s;
5212+
char_u *e;
5213+
char_u *match;
5214+
garray_T ga;
5215+
int i;
5216+
int pat_len;
5217+
5218+
*num_file = 0;
5219+
*file = NULL;
5220+
pat_len = (int)STRLEN(pat);
5221+
ga_init2(&ga, (int)sizeof(char *), 10);
5222+
5223+
s = alloc((unsigned)(pat_len + 26));
5224+
if (s == NULL)
5225+
{
5226+
ga_clear_strings(&ga);
5227+
return FAIL;
5228+
}
5229+
sprintf((char *)s, "pack/*/opt/%s*", pat);
5230+
globpath(p_pp, s, &ga, 0);
5231+
vim_free(s);
5232+
5233+
for (i = 0; i < ga.ga_len; ++i)
5234+
{
5235+
match = ((char_u **)ga.ga_data)[i];
5236+
s = gettail(match);
5237+
e = s + STRLEN(s);
5238+
mch_memmove(match, s, e - s + 1);
5239+
}
5240+
5241+
if (ga.ga_len == 0)
5242+
return FAIL;
5243+
5244+
/* Sort and remove duplicates which can happen when specifying multiple
5245+
* directories in dirnames. */
5246+
remove_duplicates(&ga);
5247+
5248+
*file = ga.ga_data;
5249+
*num_file = ga.ga_len;
5250+
return OK;
5251+
}
5252+
51975253
#endif
51985254

51995255
#if defined(FEAT_CMDL_COMPL) || defined(FEAT_EVAL) || defined(PROTO)
@@ -5741,6 +5797,7 @@ clr_history(int histype)
57415797
{
57425798
vim_free(hisptr->hisstr);
57435799
clear_hist_entry(hisptr);
5800+
hisptr++;
57445801
}
57455802
hisidx[histype] = -1; /* mark history as cleared */
57465803
hisnum[histype] = 0; /* reset identifier counter */

src/gui_gtk_x11.c

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -617,9 +617,9 @@ visibility_event(GtkWidget *widget UNUSED,
617617
*/
618618
#if GTK_CHECK_VERSION(3,0,0)
619619
static gboolean is_key_pressed = FALSE;
620+
static gboolean blink_mode = TRUE;
620621

621622
static gboolean gui_gtk_is_blink_on(void);
622-
static gboolean gui_gtk_is_no_blink(void);
623623
static void gui_gtk_window_clear(GdkWindow *win);
624624

625625
static void
@@ -649,7 +649,6 @@ gui_gtk3_should_draw_cursor(void)
649649
cond |= gui_gtk_is_blink_on();
650650
cond |= is_key_pressed;
651651
cond |= gui.in_focus == FALSE;
652-
cond |= gui_gtk_is_no_blink();
653652
return cond;
654653
}
655654

@@ -681,7 +680,10 @@ draw_event(GtkWidget *widget,
681680
for (i = 0; i < list->num_rectangles; i++)
682681
{
683682
const cairo_rectangle_t rect = list->rectangles[i];
684-
gui_gtk3_redraw(rect.x, rect.y, rect.width, rect.height);
683+
if (blink_mode)
684+
gui_gtk3_redraw(rect.x, rect.y, rect.width, rect.height);
685+
else
686+
gui_redraw(rect.x, rect.y, rect.width, rect.height);
685687
}
686688
}
687689
cairo_rectangle_list_destroy(list);
@@ -790,20 +792,33 @@ gui_gtk_is_blink_on(void)
790792
{
791793
return blink_state == BLINK_ON;
792794
}
793-
794-
static gboolean
795-
gui_gtk_is_no_blink(void)
796-
{
797-
return blink_waittime == 0 || blink_ontime == 0 || blink_offtime == 0;
798-
}
799795
#endif
800796

801797
void
802798
gui_mch_set_blinking(long waittime, long on, long off)
803799
{
800+
#if GTK_CHECK_VERSION(3,0,0)
801+
if (waittime == 0 || on == 0 || off == 0)
802+
{
803+
blink_mode = FALSE;
804+
805+
blink_waittime = 700;
806+
blink_ontime = 400;
807+
blink_offtime = 250;
808+
}
809+
else
810+
{
811+
blink_mode = TRUE;
812+
813+
blink_waittime = waittime;
814+
blink_ontime = on;
815+
blink_offtime = off;
816+
}
817+
#else
804818
blink_waittime = waittime;
805819
blink_ontime = on;
806820
blink_offtime = off;
821+
#endif
807822
}
808823

809824
/*

src/json.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ json_decode_object(js_read_T *reader, typval_T *res, int options)
506506
return FAIL;
507507
}
508508
di->di_tv = item;
509+
di->di_tv.v_lock = 0;
509510
if (dict_add(res->vval.v_dict, di) == FAIL)
510511
{
511512
dictitem_free(di);

src/ops.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,15 @@ shift_block(oparg_T *oap, int amount)
410410
{
411411
#ifdef FEAT_MBYTE
412412
if (has_mbyte)
413-
bd.textstart += (*mb_ptr2len)(bd.textstart);
413+
{
414+
if ((*mb_ptr2len)(bd.textstart) == 1)
415+
++bd.textstart;
416+
else
417+
{
418+
ws_vcol = 0;
419+
bd.startspaces = 0;
420+
}
421+
}
414422
else
415423
#endif
416424
++bd.textstart;

src/os_unix.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5059,16 +5059,15 @@ mch_call_shell(
50595059

50605060
#if defined(FEAT_JOB) || defined(PROTO)
50615061
void
5062-
mch_start_job(char **argv, job_T *job, jobopt_T *options)
5062+
mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED)
50635063
{
50645064
pid_t pid;
5065+
# ifdef FEAT_CHANNEL
50655066
int fd_in[2]; /* for stdin */
50665067
int fd_out[2]; /* for stdout */
50675068
int fd_err[2]; /* for stderr */
5068-
# ifdef FEAT_CHANNEL
50695069
channel_T *channel = NULL;
50705070
int use_out_for_err = options->jo_io[PART_ERR] == JIO_OUT;
5071-
#endif
50725071

50735072
/* default is to fail */
50745073
job->jv_status = JOB_FAILED;
@@ -5077,7 +5076,6 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options)
50775076
fd_err[0] = -1;
50785077

50795078
/* TODO: without the channel feature connect the child to /dev/null? */
5080-
# ifdef FEAT_CHANNEL
50815079
/* Open pipes for stdin, stdout, stderr. */
50825080
if (pipe(fd_in) < 0 || pipe(fd_out) < 0
50835081
|| (!use_out_for_err && pipe(fd_err) < 0))
@@ -5136,7 +5134,6 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options)
51365134
close(1);
51375135
ignored = dup(fd_out[1]);
51385136
close(fd_out[1]);
5139-
51405137
# endif
51415138

51425139
/* See above for type of argv. */
@@ -5153,14 +5150,12 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options)
51535150
job->jv_channel = channel;
51545151
# endif
51555152

5153+
# ifdef FEAT_CHANNEL
51565154
/* child stdin, stdout and stderr */
51575155
close(fd_in[0]);
51585156
close(fd_out[1]);
5159-
# ifdef FEAT_CHANNEL
51605157
if (!use_out_for_err)
5161-
# endif
51625158
close(fd_err[1]);
5163-
# ifdef FEAT_CHANNEL
51645159
channel_set_pipes(channel, fd_in[1], fd_out[0],
51655160
use_out_for_err ? INVALID_FD : fd_err[0]);
51665161
channel_set_job(channel, job, options);
@@ -5171,11 +5166,10 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options)
51715166

51725167
return;
51735168

5174-
failed:
5169+
failed: ;
51755170
# ifdef FEAT_CHANNEL
51765171
if (channel != NULL)
51775172
channel_free(channel);
5178-
# endif
51795173
if (fd_in[0] >= 0)
51805174
{
51815175
close(fd_in[0]);
@@ -5191,6 +5185,7 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options)
51915185
close(fd_err[0]);
51925186
close(fd_err[1]);
51935187
}
5188+
# endif
51945189
}
51955190

51965191
char *

src/testdir/Make_all.mak

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ NEW_TESTS = test_arglist.res \
175175
test_cdo.res \
176176
test_channel.res \
177177
test_hardcopy.res \
178+
test_history.res \
178179
test_increment.res \
179180
test_json.res \
180181
test_langmap.res \
@@ -184,6 +185,7 @@ NEW_TESTS = test_arglist.res \
184185
test_syntax.res \
185186
test_viminfo.res \
186187
test_viml.res \
188+
test_visual.res \
187189
test_alot.res
188190

189191

src/testdir/test_channel.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ def handle(self):
143143
print("sending: {}".format(cmd))
144144
self.request.sendall(cmd.encode('utf-8'))
145145
response = ""
146+
elif decoded[1] == 'send zero':
147+
cmd = '[0,"zero index"]'
148+
print("sending: {}".format(cmd))
149+
self.request.sendall(cmd.encode('utf-8'))
150+
response = "sent zero"
146151
elif decoded[1] == 'close me':
147152
print("closing")
148153
self.request.close()

0 commit comments

Comments
 (0)