From 4f77f046d00d81d083fa1614e7fb6099dc791a62 Mon Sep 17 00:00:00 2001 From: Farow Date: Tue, 13 Aug 2013 04:19:14 +0300 Subject: [PATCH 1/2] Channel url and cursor fix - Allow colons in channel urls - Only add the channel part in the context menu - Fix cursor not changing between separator and url --- src/common/url.c | 2 +- src/fe-gtk/maingui.c | 2 ++ src/fe-gtk/xtext.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/url.c b/src/common/url.c index 1cdfdce7..856ba5a7 100644 --- a/src/common/url.c +++ b/src/common/url.c @@ -650,7 +650,7 @@ re_nick (void) } /* CHANNEL description --- */ -#define CHANNEL "[" CHANPRE "][^ \t\a,:]+" +#define CHANNEL "[" CHANPRE "][^ \t\a,]+" static const GRegex * re_channel (void) diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index 84df4b96..17dc4e75 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -2306,6 +2306,8 @@ mg_word_clicked (GtkWidget *xtext, char *word, GdkEventButton *even) menu_nickmenu (sess, even, word, FALSE); break; case WORD_CHANNEL: + word[end] = 0; + word += start; menu_chanmenu (sess, even, word); break; case WORD_EMAIL: diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c index 7582f82c..8a9b596a 100644 --- a/src/fe-gtk/xtext.c +++ b/src/fe-gtk/xtext.c @@ -2139,6 +2139,7 @@ gtk_xtext_motion_notify (GtkWidget * widget, GdkEventMotion * event) { gdk_window_set_cursor (GTK_WIDGET (xtext)->window, xtext->resize_cursor); + xtext->cursor_hand = FALSE; xtext->cursor_resize = TRUE; } return FALSE; @@ -2161,6 +2162,7 @@ gtk_xtext_motion_notify (GtkWidget * widget, GdkEventMotion * event) gdk_window_set_cursor (GTK_WIDGET (xtext)->window, xtext->hand_cursor); xtext->cursor_hand = TRUE; + xtext->cursor_resize = FALSE; } /* un-render the old hilight */ From 73d63ca3da0067bfdef7e6c5458029ceaf5dfa98 Mon Sep 17 00:00:00 2001 From: Farow Date: Tue, 13 Aug 2013 07:39:34 +0300 Subject: [PATCH 2/2] Allow multiple channels in url, fix nick re - Multiple channels have to be separated by a comma - Fix #nick becoming a url for nick instead of #nick --- src/common/url.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/url.c b/src/common/url.c index 856ba5a7..57d8d88b 100644 --- a/src/common/url.c +++ b/src/common/url.c @@ -627,7 +627,7 @@ re_email (void) /* Rationale is that do_an_re() above will anyway look up what */ /* we find, and that WORD_NICK is the last item in the array */ /* that do_an_re() runs through. */ -#define NICK0 "[" NICKPRE "]?[" NICKLET NICKDIG NICKSPE "]" +#define NICK0 "^[" NICKPRE "]?[" NICKLET NICKDIG NICKSPE "]" #endif #define NICK1 "[" NICKHYP NICKLET NICKDIG NICKSPE "]*" #define NICK NICK0 NICK1 @@ -650,7 +650,7 @@ re_nick (void) } /* CHANNEL description --- */ -#define CHANNEL "[" CHANPRE "][^ \t\a,]+" +#define CHANNEL "[" CHANPRE "][^ \t\a,]+(?:,[" CHANPRE "][^ \t\a,]+)*" static const GRegex * re_channel (void)