mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
updated for version 7.2.334
Problem: Postponing keys in Netbeans interface does not work properly. Solution: Store the key string instead of the number. Avoid an infinite loop. (Mostly by Xavier de Gaye)
This commit is contained in:
parent
2660c0ea9b
commit
8065d7fd9c
@ -70,7 +70,8 @@ static long pos2off __ARGS((buf_T *, pos_T *));
|
|||||||
static pos_T *off2pos __ARGS((buf_T *, long));
|
static pos_T *off2pos __ARGS((buf_T *, long));
|
||||||
static pos_T *get_off_or_lnum __ARGS((buf_T *buf, char_u **argp));
|
static pos_T *get_off_or_lnum __ARGS((buf_T *buf, char_u **argp));
|
||||||
static long get_buf_size __ARGS((buf_T *));
|
static long get_buf_size __ARGS((buf_T *));
|
||||||
static void netbeans_keystring __ARGS((int key, char *keystr));
|
static int netbeans_keystring __ARGS((char_u *keystr));
|
||||||
|
static void postpone_keycommand __ARGS((char_u *keystr));
|
||||||
static void special_keys __ARGS((char_u *args));
|
static void special_keys __ARGS((char_u *args));
|
||||||
|
|
||||||
static void netbeans_connect __ARGS((void));
|
static void netbeans_connect __ARGS((void));
|
||||||
@ -502,7 +503,7 @@ getConnInfo(char *file, char **host, char **port, char **auth)
|
|||||||
|
|
||||||
struct keyqueue
|
struct keyqueue
|
||||||
{
|
{
|
||||||
int key;
|
char_u *keystr;
|
||||||
struct keyqueue *next;
|
struct keyqueue *next;
|
||||||
struct keyqueue *prev;
|
struct keyqueue *prev;
|
||||||
};
|
};
|
||||||
@ -514,13 +515,17 @@ static keyQ_T keyHead; /* dummy node, header for circular queue */
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Queue up key commands sent from netbeans.
|
* Queue up key commands sent from netbeans.
|
||||||
|
* We store the string, because it may depend on the global mod_mask and
|
||||||
|
* :nbkey doesn't have a key number.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
postpone_keycommand(int key)
|
postpone_keycommand(char_u *keystr)
|
||||||
{
|
{
|
||||||
keyQ_T *node;
|
keyQ_T *node;
|
||||||
|
|
||||||
node = (keyQ_T *)alloc(sizeof(keyQ_T));
|
node = (keyQ_T *)alloc(sizeof(keyQ_T));
|
||||||
|
if (node == NULL)
|
||||||
|
return; /* out of memory, drop the key */
|
||||||
|
|
||||||
if (keyHead.next == NULL) /* initialize circular queue */
|
if (keyHead.next == NULL) /* initialize circular queue */
|
||||||
{
|
{
|
||||||
@ -534,7 +539,7 @@ postpone_keycommand(int key)
|
|||||||
keyHead.prev->next = node;
|
keyHead.prev->next = node;
|
||||||
keyHead.prev = node;
|
keyHead.prev = node;
|
||||||
|
|
||||||
node->key = key;
|
node->keystr = vim_strsave(keystr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -543,15 +548,20 @@ postpone_keycommand(int key)
|
|||||||
static void
|
static void
|
||||||
handle_key_queue(void)
|
handle_key_queue(void)
|
||||||
{
|
{
|
||||||
while (keyHead.next && keyHead.next != &keyHead)
|
int postponed = FALSE;
|
||||||
|
|
||||||
|
while (!postponed && keyHead.next && keyHead.next != &keyHead)
|
||||||
{
|
{
|
||||||
/* first, unlink the node */
|
/* first, unlink the node */
|
||||||
keyQ_T *node = keyHead.next;
|
keyQ_T *node = keyHead.next;
|
||||||
keyHead.next = node->next;
|
keyHead.next = node->next;
|
||||||
node->next->prev = node->prev;
|
node->next->prev = node->prev;
|
||||||
|
|
||||||
/* now, send the keycommand */
|
/* Now, send the keycommand. This may cause it to be postponed again
|
||||||
netbeans_keycommand(node->key);
|
* and change keyHead. */
|
||||||
|
if (node->keystr != NULL)
|
||||||
|
postponed = !netbeans_keystring(node->keystr);
|
||||||
|
vim_free(node->keystr);
|
||||||
|
|
||||||
/* Finally, dispose of the node */
|
/* Finally, dispose of the node */
|
||||||
vim_free(node);
|
vim_free(node);
|
||||||
@ -2495,7 +2505,7 @@ nb_do_cmd(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nbdebug((" Buffer has no changes!\n"));
|
nbdebug((" Buffer has no changes!\n"));
|
||||||
}
|
}
|
||||||
/* =====================================================================*/
|
/* =====================================================================*/
|
||||||
}
|
}
|
||||||
@ -2658,7 +2668,7 @@ special_keys(char_u *args)
|
|||||||
ex_nbkey(eap)
|
ex_nbkey(eap)
|
||||||
exarg_T *eap;
|
exarg_T *eap;
|
||||||
{
|
{
|
||||||
netbeans_keystring(0, (char *)eap->arg);
|
(void)netbeans_keystring(eap->arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2680,7 +2690,7 @@ nb_init_graphics(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert key to netbeans name.
|
* Convert key to netbeans name. This uses the global "mod_mask".
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
netbeans_keyname(int key, char *buf)
|
netbeans_keyname(int key, char *buf)
|
||||||
@ -3127,23 +3137,27 @@ netbeans_button_release(int button)
|
|||||||
/*
|
/*
|
||||||
* Send a keypress event back to netbeans. This usually simulates some
|
* Send a keypress event back to netbeans. This usually simulates some
|
||||||
* kind of function key press. This function operates on a key code.
|
* kind of function key press. This function operates on a key code.
|
||||||
|
* Return TRUE when the key was sent, FALSE when the command has been
|
||||||
|
* postponed.
|
||||||
*/
|
*/
|
||||||
void
|
int
|
||||||
netbeans_keycommand(int key)
|
netbeans_keycommand(int key)
|
||||||
{
|
{
|
||||||
char keyName[60];
|
char keyName[60];
|
||||||
|
|
||||||
netbeans_keyname(key, keyName);
|
netbeans_keyname(key, keyName);
|
||||||
netbeans_keystring(key, keyName);
|
return netbeans_keystring((char_u *)keyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send a keypress event back to netbeans. This usually simulates some
|
* Send a keypress event back to netbeans. This usually simulates some
|
||||||
* kind of function key press. This function operates on a key string.
|
* kind of function key press. This function operates on a key string.
|
||||||
|
* Return TRUE when the key was sent, FALSE when the command has been
|
||||||
|
* postponed.
|
||||||
*/
|
*/
|
||||||
static void
|
static int
|
||||||
netbeans_keystring(int key, char *keyName)
|
netbeans_keystring(char_u *keyName)
|
||||||
{
|
{
|
||||||
char buf[2*MAXPATHL];
|
char buf[2*MAXPATHL];
|
||||||
int bufno = nb_getbufno(curbuf);
|
int bufno = nb_getbufno(curbuf);
|
||||||
@ -3151,7 +3165,7 @@ netbeans_keystring(int key, char *keyName)
|
|||||||
char_u *q;
|
char_u *q;
|
||||||
|
|
||||||
if (!haveConnection)
|
if (!haveConnection)
|
||||||
return;
|
return TRUE;
|
||||||
|
|
||||||
|
|
||||||
if (bufno == -1)
|
if (bufno == -1)
|
||||||
@ -3160,7 +3174,7 @@ netbeans_keystring(int key, char *keyName)
|
|||||||
q = curbuf->b_ffname == NULL ? (char_u *)""
|
q = curbuf->b_ffname == NULL ? (char_u *)""
|
||||||
: nb_quote(curbuf->b_ffname);
|
: nb_quote(curbuf->b_ffname);
|
||||||
if (q == NULL)
|
if (q == NULL)
|
||||||
return;
|
return TRUE;
|
||||||
vim_snprintf(buf, sizeof(buf), "0:fileOpened=%d \"%s\" %s %s\n", 0,
|
vim_snprintf(buf, sizeof(buf), "0:fileOpened=%d \"%s\" %s %s\n", 0,
|
||||||
q,
|
q,
|
||||||
"T", /* open in NetBeans */
|
"T", /* open in NetBeans */
|
||||||
@ -3170,9 +3184,8 @@ netbeans_keystring(int key, char *keyName)
|
|||||||
nbdebug(("EVT: %s", buf));
|
nbdebug(("EVT: %s", buf));
|
||||||
nb_send(buf, "netbeans_keycommand");
|
nb_send(buf, "netbeans_keycommand");
|
||||||
|
|
||||||
if (key > 0)
|
postpone_keycommand(keyName);
|
||||||
postpone_keycommand(key);
|
return FALSE;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sync the cursor position */
|
/* sync the cursor position */
|
||||||
@ -3198,6 +3211,7 @@ netbeans_keystring(int key, char *keyName)
|
|||||||
off, (long)curwin->w_cursor.lnum, (long)curwin->w_cursor.col);
|
off, (long)curwin->w_cursor.lnum, (long)curwin->w_cursor.col);
|
||||||
nbdebug(("EVT: %s", buf));
|
nbdebug(("EVT: %s", buf));
|
||||||
nb_send(buf, "netbeans_keycommand");
|
nb_send(buf, "netbeans_keycommand");
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ void netbeans_inserted __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, char_u
|
|||||||
void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len));
|
void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len));
|
||||||
void netbeans_unmodified __ARGS((buf_T *bufp));
|
void netbeans_unmodified __ARGS((buf_T *bufp));
|
||||||
void netbeans_button_release __ARGS((int button));
|
void netbeans_button_release __ARGS((int button));
|
||||||
void netbeans_keycommand __ARGS((int key));
|
int netbeans_keycommand __ARGS((int key));
|
||||||
void netbeans_save_buffer __ARGS((buf_T *bufp));
|
void netbeans_save_buffer __ARGS((buf_T *bufp));
|
||||||
void netbeans_deleted_all_lines __ARGS((buf_T *bufp));
|
void netbeans_deleted_all_lines __ARGS((buf_T *bufp));
|
||||||
int netbeans_is_guarded __ARGS((linenr_T top, linenr_T bot));
|
int netbeans_is_guarded __ARGS((linenr_T top, linenr_T bot));
|
||||||
|
@ -681,6 +681,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
334,
|
||||||
/**/
|
/**/
|
||||||
333,
|
333,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user