mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Merge remote-tracking branch 'vim/master'
This commit is contained in:
+18
-3
@@ -204,8 +204,9 @@ static void ex_tearoff(exarg_T *eap);
|
||||
#else
|
||||
# define ex_tearoff ex_ni
|
||||
#endif
|
||||
#if defined(FEAT_MENU) && (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) \
|
||||
|| defined(FEAT_GUI_MACVIM))
|
||||
#if (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) \
|
||||
|| defined(FEAT_GUI_MACVIM) \
|
||||
|| defined(FEAT_TERM_POPUP_MENU)) && defined(FEAT_MENU)
|
||||
static void ex_popup(exarg_T *eap);
|
||||
#else
|
||||
# define ex_popup ex_ni
|
||||
@@ -8759,12 +8760,26 @@ ex_tearoff(exarg_T *eap)
|
||||
}
|
||||
#endif
|
||||
|
||||
<<<<<<< HEAD
|
||||
#if defined(FEAT_MENU) && (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) \
|
||||
|| defined(FEAT_GUI_MACVIM))
|
||||
=======
|
||||
#if (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) \
|
||||
|| defined(FEAT_TERM_POPUP_MENU)) && defined(FEAT_MENU)
|
||||
>>>>>>> vim/master
|
||||
static void
|
||||
ex_popup(exarg_T *eap)
|
||||
{
|
||||
gui_make_popup(eap->arg, eap->forceit);
|
||||
# if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK)
|
||||
if (gui.in_use)
|
||||
gui_make_popup(eap->arg, eap->forceit);
|
||||
# ifdef FEAT_TERM_POPUP_MENU
|
||||
else
|
||||
# endif
|
||||
# endif
|
||||
# ifdef FEAT_TERM_POPUP_MENU
|
||||
pum_make_popup(eap->arg, eap->forceit);
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+12
-7
@@ -1897,6 +1897,16 @@ get_menu_mode(void)
|
||||
return MENU_INDEX_INVALID;
|
||||
}
|
||||
|
||||
int
|
||||
get_menu_mode_flag(void)
|
||||
{
|
||||
int mode = get_menu_mode();
|
||||
|
||||
if (mode == MENU_INDEX_INVALID)
|
||||
return 0;
|
||||
return 1 << mode;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display the Special "PopUp" menu as a pop-up at the current mouse
|
||||
* position. The "PopUpn" menu is for Normal mode, "PopUpi" for Insert mode,
|
||||
@@ -2050,13 +2060,7 @@ gui_update_menus(int modes)
|
||||
if (modes != 0x0)
|
||||
mode = modes;
|
||||
else
|
||||
{
|
||||
mode = get_menu_mode();
|
||||
if (mode == MENU_INDEX_INVALID)
|
||||
mode = 0;
|
||||
else
|
||||
mode = (1 << mode);
|
||||
}
|
||||
mode = get_menu_mode_flag();
|
||||
|
||||
if (force_menu_update || mode != prev_mode)
|
||||
{
|
||||
@@ -2485,6 +2489,7 @@ winbar_click(win_T *wp, int col)
|
||||
}
|
||||
|
||||
#if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) \
|
||||
|| defined(FEAT_TERM_POPUP_MENU) \
|
||||
|| defined(FEAT_GUI_MACVIM) \
|
||||
|| defined(FEAT_BEVAL_TIP) || defined(PROTO)
|
||||
/*
|
||||
|
||||
+2
-3
@@ -563,10 +563,9 @@ mch_check_messages(void)
|
||||
# if defined(HAVE_SYS_SYSINFO_H) && defined(HAVE_SYSINFO)
|
||||
# include <sys/sysinfo.h>
|
||||
# endif
|
||||
# ifdef MACOS_X_DARWIN
|
||||
# ifdef MACOS_X
|
||||
# include <mach/mach_host.h>
|
||||
# include <mach/mach_port.h>
|
||||
# include <mach/vm_page_size.h>
|
||||
# endif
|
||||
|
||||
/*
|
||||
@@ -579,7 +578,7 @@ mch_total_mem(int special UNUSED)
|
||||
long_u mem = 0;
|
||||
long_u shiftright = 10; /* how much to shift "mem" right for Kbyte */
|
||||
|
||||
# ifdef MACOS_X_DARWIN
|
||||
# ifdef MACOS_X
|
||||
{
|
||||
/* Mac (Darwin) way of getting the amount of RAM available */
|
||||
mach_port_t host = mach_host_self();
|
||||
|
||||
+24
-2
@@ -1132,12 +1132,16 @@ pum_show_popupmenu(vimmenu_T *menu)
|
||||
#ifdef FEAT_BEVAL_TERM
|
||||
int save_bevalterm = p_bevalterm;
|
||||
#endif
|
||||
int mode;
|
||||
|
||||
pum_undisplay();
|
||||
pum_size = 0;
|
||||
mode = get_menu_mode_flag();
|
||||
|
||||
for (mp = menu->children; mp != NULL; mp = mp->next)
|
||||
++pum_size;
|
||||
if (menu_is_separator(mp->dname)
|
||||
|| (mp->modes & mp->enabled & mode))
|
||||
++pum_size;
|
||||
|
||||
array = (pumitem_T *)alloc_clear((unsigned)sizeof(pumitem_T) * pum_size);
|
||||
if (array == NULL)
|
||||
@@ -1146,7 +1150,7 @@ pum_show_popupmenu(vimmenu_T *menu)
|
||||
for (mp = menu->children; mp != NULL; mp = mp->next)
|
||||
if (menu_is_separator(mp->dname))
|
||||
array[idx++].pum_text = (char_u *)"";
|
||||
else
|
||||
else if (mp->modes & mp->enabled & mode)
|
||||
array[idx++].pum_text = mp->dname;
|
||||
|
||||
pum_array = array;
|
||||
@@ -1231,6 +1235,24 @@ pum_show_popupmenu(vimmenu_T *menu)
|
||||
p_bevalterm = save_bevalterm;
|
||||
mch_setmouse(TRUE);
|
||||
# endif
|
||||
}
|
||||
|
||||
void
|
||||
pum_make_popup(char_u *path_name, int use_mouse_pos)
|
||||
{
|
||||
vimmenu_T *menu;
|
||||
|
||||
if (!use_mouse_pos)
|
||||
{
|
||||
/* Hack: set mouse position at the cursor so that the menu pops up
|
||||
* around there. */
|
||||
mouse_row = curwin->w_winrow + curwin->w_wrow;
|
||||
mouse_col = curwin->w_wincol + curwin->w_wcol;
|
||||
}
|
||||
|
||||
menu = gui_find_menu(path_name);
|
||||
if (menu != NULL)
|
||||
pum_show_popupmenu(menu);
|
||||
}
|
||||
# endif
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ int menu_is_popup(char_u *name);
|
||||
int menu_is_child_of_popup(vimmenu_T *menu);
|
||||
int menu_is_toolbar(char_u *name);
|
||||
int menu_is_separator(char_u *name);
|
||||
int get_menu_mode_flag(void);
|
||||
void show_popupmenu(void);
|
||||
int check_menu_pointer(vimmenu_T *root, vimmenu_T *menu_to_check);
|
||||
void gui_create_initial_menus(vimmenu_T *menu);
|
||||
|
||||
@@ -10,4 +10,5 @@ void ui_remove_balloon(void);
|
||||
void ui_post_balloon(char_u *mesg, list_T *list);
|
||||
void ui_may_remove_balloon(void);
|
||||
void pum_show_popupmenu(vimmenu_T *menu);
|
||||
void pum_make_popup(char_u *path_name, int mouse_pos);
|
||||
/* vim: set ft=c : */
|
||||
|
||||
+1
-1
@@ -4099,7 +4099,7 @@ ex_cfile(exarg_T *eap)
|
||||
win_T *wp = NULL;
|
||||
qf_info_T *qi = &ql_info;
|
||||
char_u *au_name = NULL;
|
||||
int save_qfid;
|
||||
int save_qfid = 0; // init for gcc
|
||||
int res;
|
||||
|
||||
switch (eap->cmdidx)
|
||||
|
||||
+33
-11
@@ -143,6 +143,9 @@ static int rbm_status = STATUS_GET;
|
||||
|
||||
/* Request cursor style report: */
|
||||
static int rcs_status = STATUS_GET;
|
||||
|
||||
/* Request windos position report: */
|
||||
static int winpos_status = STATUS_GET;
|
||||
# endif
|
||||
|
||||
/*
|
||||
@@ -2784,9 +2787,9 @@ can_get_termresponse()
|
||||
&& p_ek;
|
||||
}
|
||||
|
||||
static int winpos_x;
|
||||
static int winpos_y;
|
||||
static int waiting_for_winpos = FALSE;
|
||||
static int winpos_x = -1;
|
||||
static int winpos_y = -1;
|
||||
static int did_request_winpos = 0;
|
||||
|
||||
/*
|
||||
* Try getting the Vim window position from the terminal.
|
||||
@@ -2796,29 +2799,43 @@ static int waiting_for_winpos = FALSE;
|
||||
term_get_winpos(int *x, int *y, varnumber_T timeout)
|
||||
{
|
||||
int count = 0;
|
||||
int prev_winpos_x = winpos_x;
|
||||
int prev_winpos_y = winpos_y;
|
||||
|
||||
if (*T_CGP == NUL || !can_get_termresponse())
|
||||
return FAIL;
|
||||
winpos_x = -1;
|
||||
winpos_y = -1;
|
||||
waiting_for_winpos = TRUE;
|
||||
++did_request_winpos;
|
||||
winpos_status = STATUS_SENT;
|
||||
OUT_STR(T_CGP);
|
||||
out_flush();
|
||||
|
||||
/* Try reading the result for "timeout" msec. */
|
||||
while (count++ < timeout / 10)
|
||||
while (count++ <= timeout / 10 && !got_int)
|
||||
{
|
||||
(void)vpeekc_nomap();
|
||||
if (winpos_x >= 0 && winpos_y >= 0)
|
||||
{
|
||||
*x = winpos_x;
|
||||
*y = winpos_y;
|
||||
waiting_for_winpos = FALSE;
|
||||
return OK;
|
||||
}
|
||||
ui_delay(10, FALSE);
|
||||
}
|
||||
waiting_for_winpos = FALSE;
|
||||
/* Do not reset "did_request_winpos", if we timed out the response might
|
||||
* still come later and we must consume it. */
|
||||
|
||||
winpos_x = prev_winpos_x;
|
||||
winpos_y = prev_winpos_y;
|
||||
if (timeout < 10 && prev_winpos_y >= 0 && prev_winpos_y >= 0)
|
||||
{
|
||||
/* Polling: return previous values if we have them. */
|
||||
*x = winpos_x;
|
||||
*y = winpos_y;
|
||||
return OK;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
# endif
|
||||
@@ -3371,7 +3388,8 @@ settmode(int tmode)
|
||||
#endif
|
||||
|| rbg_status == STATUS_SENT
|
||||
|| rbm_status == STATUS_SENT
|
||||
|| rcs_status == STATUS_SENT))
|
||||
|| rcs_status == STATUS_SENT
|
||||
|| winpos_status == STATUS_SENT))
|
||||
(void)vpeekc_nomap();
|
||||
check_for_codes_from_term();
|
||||
}
|
||||
@@ -3445,7 +3463,8 @@ stoptermcap(void)
|
||||
# endif
|
||||
|| rbg_status == STATUS_SENT
|
||||
|| rbm_status == STATUS_SENT
|
||||
|| rcs_status == STATUS_SENT)
|
||||
|| rcs_status == STATUS_SENT
|
||||
|| winpos_status == STATUS_SENT)
|
||||
{
|
||||
# ifdef UNIX
|
||||
/* Give the terminal a chance to respond. */
|
||||
@@ -4474,7 +4493,7 @@ check_termcode(
|
||||
*/
|
||||
char_u *argp = tp[0] == ESC ? tp + 2 : tp + 1;
|
||||
|
||||
if ((*T_CRV != NUL || *T_U7 != NUL || waiting_for_winpos)
|
||||
if ((*T_CRV != NUL || *T_U7 != NUL || did_request_winpos)
|
||||
&& ((tp[0] == ESC && len >= 3 && tp[1] == '[')
|
||||
|| (tp[0] == CSI && len >= 2))
|
||||
&& (VIM_ISDIGIT(*argp) || *argp == '>' || *argp == '?'))
|
||||
@@ -4736,7 +4755,7 @@ check_termcode(
|
||||
* Check for a window position response from the terminal:
|
||||
* {lead}3;{x}:{y}t
|
||||
*/
|
||||
else if (waiting_for_winpos
|
||||
else if (did_request_winpos
|
||||
&& ((len >= 4 && tp[0] == ESC && tp[1] == '[')
|
||||
|| (len >= 3 && tp[0] == CSI))
|
||||
&& tp[(j = 1 + (tp[0] == ESC))] == '3'
|
||||
@@ -4758,6 +4777,9 @@ check_termcode(
|
||||
key_name[0] = (int)KS_EXTRA;
|
||||
key_name[1] = (int)KE_IGNORE;
|
||||
slen = i + 1;
|
||||
|
||||
if (--did_request_winpos <= 0)
|
||||
winpos_status = STATUS_GOT;
|
||||
}
|
||||
}
|
||||
if (i == len)
|
||||
|
||||
@@ -781,6 +781,18 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1573,
|
||||
/**/
|
||||
1572,
|
||||
/**/
|
||||
1571,
|
||||
/**/
|
||||
1570,
|
||||
/**/
|
||||
1569,
|
||||
/**/
|
||||
1568,
|
||||
/**/
|
||||
1567,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user