Merge pull request #545 from RichardHitt/issue522

Fix broken logic in mg_word_clicked().  fixes #522
This commit is contained in:
TingPing 2013-04-15 13:54:00 -07:00
commit 86564c8741
1 changed files with 19 additions and 14 deletions

View File

@ -2236,25 +2236,28 @@ mg_word_clicked (GtkWidget *xtext, char *word, GdkEventButton *even)
int word_type, start, end; int word_type, start, end;
char *tmp; char *tmp;
if (word == NULL) if (word)
{ {
if (even->button == 1) /* left button */ word_type = mg_word_check (xtext, word);
mg_focus (sess); url_last (&start, &end);
return;
} }
word_type = mg_word_check (xtext, word); if (even->button == 1) /* left button */
url_last (&start, &end);
if (even->button == 1 && (even->state & 13) == prefs.hex_gui_url_mod)
{ {
switch (word_type) if (word == NULL)
{ {
case WORD_URL: mg_focus (sess);
case WORD_HOST: return;
word[end] = 0; }
word += start;
fe_open_url (word); if ((even->state & 13) == prefs.hex_gui_url_mod)
{
switch (word_type)
{
case WORD_URL:
case WORD_HOST:
fe_open_url (word);
}
} }
return; return;
} }
@ -2267,6 +2270,8 @@ mg_word_clicked (GtkWidget *xtext, char *word, GdkEventButton *even)
userlist_select (sess, word); userlist_select (sess, word);
return; return;
} }
if (word == NULL)
return;
switch (word_type) switch (word_type)
{ {