Skip to content

Commit 08aae8d

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 2cc13f8 + 3324d0a commit 08aae8d

21 files changed

Lines changed: 299 additions & 40 deletions

src/edit.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8921,7 +8921,17 @@ ins_del(void)
89218921
|| do_join(2, FALSE, TRUE, FALSE, FALSE) == FAIL)
89228922
vim_beep(BO_BS);
89238923
else
8924+
{
89248925
curwin->w_cursor.col = temp;
8926+
#ifdef FEAT_VREPLACE
8927+
/* Adjust orig_line_count in case more lines have been deleted than
8928+
* have been added. That makes sure, that open_line() later
8929+
* can access all buffer lines correctly */
8930+
if (State & VREPLACE_FLAG &&
8931+
orig_line_count > curbuf->b_ml.ml_line_count)
8932+
orig_line_count = curbuf->b_ml.ml_line_count;
8933+
#endif
8934+
}
89258935
}
89268936
else if (del_char(FALSE) == FAIL) /* delete char under cursor */
89278937
vim_beep(BO_BS);

src/feature.h

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -699,20 +699,6 @@
699699
# define FEAT_LIBCALL
700700
#endif
701701

702-
/*
703-
* +scrollbind synchronization of split windows
704-
*/
705-
#if defined(FEAT_NORMAL)
706-
# define FEAT_SCROLLBIND
707-
#endif
708-
709-
/*
710-
* +cursorbind synchronization of split windows
711-
*/
712-
#if defined(FEAT_NORMAL)
713-
# define FEAT_CURSORBIND
714-
#endif
715-
716702
/*
717703
* +menu ":menu" command
718704
*/
@@ -1348,7 +1334,8 @@
13481334
/*
13491335
* +balloon_eval_term Allow balloon expression evaluation in the terminal.
13501336
*/
1351-
#if defined(FEAT_HUGE) && defined(UNIX) && defined(FEAT_TIMERS)
1337+
#if defined(FEAT_HUGE) && defined(FEAT_TIMERS) && \
1338+
(defined(UNIX) || (defined(WIN32) && !defined(FEAT_GUI_W32)))
13521339
# define FEAT_BEVAL_TERM
13531340
#endif
13541341

src/if_perl.xs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,7 @@ Buffers(...)
15581558

15591559
pat = (char_u *)SvPV(sv, len);
15601560
++emsg_off;
1561-
b = buflist_findpat(pat, pat+len, FALSE, FALSE, FALSE);
1561+
b = buflist_findpat(pat, pat + len, TRUE, FALSE, FALSE);
15621562
--emsg_off;
15631563
}
15641564

src/ops.c

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -899,17 +899,21 @@ valid_yank_reg(
899899
*
900900
* If regname is 0 and writing, use register 0
901901
* If regname is 0 and reading, use previous register
902+
*
903+
* Return TRUE when the register should be inserted literally (selection or
904+
* clipboard).
902905
*/
903-
void
906+
int
904907
get_yank_register(int regname, int writing)
905908
{
906909
int i;
910+
int ret = FALSE;
907911

908912
y_append = FALSE;
909913
if ((regname == 0 || regname == '"') && !writing && y_previous != NULL)
910914
{
911915
y_current = y_previous;
912-
return;
916+
return ret;
913917
}
914918
i = regname;
915919
if (VIM_ISDIGIT(i))
@@ -926,10 +930,16 @@ get_yank_register(int regname, int writing)
926930
#ifdef FEAT_CLIPBOARD
927931
/* When selection is not available, use register 0 instead of '*' */
928932
else if (clip_star.available && regname == '*')
933+
{
929934
i = STAR_REGISTER;
935+
ret = TRUE;
936+
}
930937
/* When clipboard is not available, use register 0 instead of '+' */
931938
else if (clip_plus.available && regname == '+')
939+
{
932940
i = PLUS_REGISTER;
941+
ret = TRUE;
942+
}
933943
#endif
934944
#ifdef FEAT_DND
935945
else if (!writing && regname == '~')
@@ -940,6 +950,7 @@ get_yank_register(int regname, int writing)
940950
y_current = &(y_regs[i]);
941951
if (writing) /* remember the register we write into for do_put() */
942952
y_previous = y_current;
953+
return ret;
943954
}
944955

945956
#if defined(FEAT_CLIPBOARD) || defined(PROTO)
@@ -1387,12 +1398,13 @@ put_in_typebuf(
13871398
int
13881399
insert_reg(
13891400
int regname,
1390-
int literally) /* insert literally, not as if typed */
1401+
int literally_arg) /* insert literally, not as if typed */
13911402
{
13921403
long i;
13931404
int retval = OK;
13941405
char_u *arg;
13951406
int allocated;
1407+
int literally = literally_arg;
13961408

13971409
/*
13981410
* It is possible to get into an endless loop by having CTRL-R a in
@@ -1423,7 +1435,8 @@ insert_reg(
14231435
}
14241436
else /* name or number register */
14251437
{
1426-
get_yank_register(regname, FALSE);
1438+
if (get_yank_register(regname, FALSE))
1439+
literally = TRUE;
14271440
if (y_current->y_array == NULL)
14281441
retval = FAIL;
14291442
else
@@ -1580,12 +1593,14 @@ get_spec_reg(
15801593
int
15811594
cmdline_paste_reg(
15821595
int regname,
1583-
int literally, /* Insert text literally instead of "as typed" */
1596+
int literally_arg, /* Insert text literally instead of "as typed" */
15841597
int remcr) /* don't add CR characters */
15851598
{
15861599
long i;
1600+
int literally = literally_arg;
15871601

1588-
get_yank_register(regname, FALSE);
1602+
if (get_yank_register(regname, FALSE))
1603+
literally = TRUE;
15891604
if (y_current->y_array == NULL)
15901605
return FAIL;
15911606

src/os_macosx.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
* os_macosx.m -- Mac specific things for Mac OS X.
1212
*/
1313

14+
/* Suppress compiler warnings to non-C89 code. */
15+
#if defined(__clang__) && defined(__STRICT_ANSI__)
16+
# pragma clang diagnostic push
17+
# pragma clang diagnostic ignored "-Wc99-extensions"
18+
# pragma clang diagnostic push
19+
# pragma clang diagnostic ignored "-Wdeclaration-after-statement"
20+
#endif
21+
1422
/* Avoid a conflict for the definition of Boolean between Mac header files and
1523
* X11 header files. */
1624
#define NO_X11_INCLUDES
@@ -190,6 +198,11 @@
190198

191199
#endif /* FEAT_CLIPBOARD */
192200

201+
/* Lift the compiler warning suppression. */
202+
#if defined(__clang__) && defined(__STRICT_ANSI__)
203+
# pragma clang diagnostic pop
204+
# pragma clang diagnostic pop
205+
#endif
193206

194207
void
195208
macosx_fork()

src/os_win32.c

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,18 @@ mch_setmouse(int on)
11641164
SetConsoleMode(g_hConIn, cmodein);
11651165
}
11661166

1167+
1168+
#if defined(FEAT_BEVAL_TERM) || defined(PROTO)
1169+
/*
1170+
* Called when 'balloonevalterm' changed.
1171+
*/
1172+
void
1173+
mch_bevalterm_changed(void)
1174+
{
1175+
mch_setmouse(g_fMouseActive);
1176+
}
1177+
#endif
1178+
11671179
/*
11681180
* Decode a MOUSE_EVENT. If it's a valid event, return MOUSE_LEFT,
11691181
* MOUSE_MIDDLE, or MOUSE_RIGHT for a click; MOUSE_DRAG for a mouse
@@ -1243,7 +1255,7 @@ decode_mouse_event(
12431255

12441256
if (pmer->dwEventFlags == MOUSE_MOVED)
12451257
{
1246-
/* ignore MOUSE_MOVED events if (x, y) hasn't changed. (We get these
1258+
/* Ignore MOUSE_MOVED events if (x, y) hasn't changed. (We get these
12471259
* events even when the mouse moves only within a char cell.) */
12481260
if (s_xOldMouse == g_xMouse && s_yOldMouse == g_yMouse)
12491261
return FALSE;
@@ -1252,11 +1264,20 @@ decode_mouse_event(
12521264
/* If no buttons are pressed... */
12531265
if ((pmer->dwButtonState & ((1 << cButtons) - 1)) == 0)
12541266
{
1267+
nButton = MOUSE_RELEASE;
1268+
12551269
/* If the last thing returned was MOUSE_RELEASE, ignore this */
12561270
if (s_fReleased)
1257-
return FALSE;
1271+
{
1272+
#ifdef FEAT_BEVAL_TERM
1273+
/* do return mouse move events when we want them */
1274+
if (p_bevalterm)
1275+
nButton = MOUSE_DRAG;
1276+
else
1277+
#endif
1278+
return FALSE;
1279+
}
12581280

1259-
nButton = MOUSE_RELEASE;
12601281
s_fReleased = TRUE;
12611282
}
12621283
else /* one or more buttons pressed */

src/popupmnu.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,14 +1104,14 @@ pum_select_mouse_pos(void)
11041104
* Execute the currently selected popup menu item.
11051105
*/
11061106
static void
1107-
pum_execute_menu(vimmenu_T *menu)
1107+
pum_execute_menu(vimmenu_T *menu, int mode)
11081108
{
11091109
vimmenu_T *mp;
11101110
int idx = 0;
11111111
exarg_T ea;
11121112

11131113
for (mp = menu->children; mp != NULL; mp = mp->next)
1114-
if (idx++ == pum_selected)
1114+
if ((mp->modes & mp->enabled & mode) && idx++ == pum_selected)
11151115
{
11161116
vim_memset(&ea, 0, sizeof(ea));
11171117
execute_menu(&ea, mp);
@@ -1171,7 +1171,7 @@ pum_show_popupmenu(vimmenu_T *menu)
11711171
int c;
11721172

11731173
pum_redraw();
1174-
setcursor();
1174+
setcursor_mayforce(TRUE);
11751175
out_flush();
11761176

11771177
c = vgetc();
@@ -1180,7 +1180,7 @@ pum_show_popupmenu(vimmenu_T *menu)
11801180
else if (c == CAR || c == NL)
11811181
{
11821182
/* enter: select current item, if any, and close */
1183-
pum_execute_menu(menu);
1183+
pum_execute_menu(menu, mode);
11841184
break;
11851185
}
11861186
else if (c == 'k' || c == K_UP || c == K_MOUSEUP)
@@ -1221,7 +1221,7 @@ pum_show_popupmenu(vimmenu_T *menu)
12211221
pum_select_mouse_pos();
12221222
if (pum_selected >= 0)
12231223
{
1224-
pum_execute_menu(menu);
1224+
pum_execute_menu(menu, mode);
12251225
break;
12261226
}
12271227
if (c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM)

src/proto/ops.pro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ void set_expr_line(char_u *new_line);
1111
char_u *get_expr_line(void);
1212
char_u *get_expr_line_src(void);
1313
int valid_yank_reg(int regname, int writing);
14-
void get_yank_register(int regname, int writing);
14+
int get_yank_register(int regname, int writing);
1515
int may_get_selection(int regname);
1616
void *get_register(int name, int copy);
1717
void put_register(int name, void *reg);
1818
void free_register(void *reg);
1919
int yank_register_mline(int regname);
2020
int do_record(int c);
2121
int do_execreg(int regname, int colon, int addcr, int silent);
22-
int insert_reg(int regname, int literally);
22+
int insert_reg(int regname, int literally_arg);
2323
int get_spec_reg(int regname, char_u **argp, int *allocated, int errmsg);
2424
int cmdline_paste_reg(int regname, int literally, int remcr);
2525
void adjust_clip_reg(int *rp);

src/proto/os_win32.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ int dyn_libintl_init(void);
66
void dyn_libintl_end(void);
77
void PlatformId(void);
88
void mch_setmouse(int on);
9+
void mch_bevalterm_changed(void);
910
void mch_update_cursor(void);
1011
int mch_char_avail(void);
1112
int mch_check_messages(void);

src/proto/screen.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ int can_clear(char_u *p);
4444
void screen_start(void);
4545
void windgoto(int row, int col);
4646
void setcursor(void);
47+
void setcursor_mayforce(int force);
4748
int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear);
4849
int win_del_lines(win_T *wp, int row, int line_count, int invalid, int mayclear, int clear_attr);
4950
int screen_ins_lines(int off, int row, int line_count, int end, int clear_attr, win_T *wp);

0 commit comments

Comments
 (0)