2004-11-08 [colin] 0.9.12cvs140.3
authorColin Leroy <colin@colino.net>
Mon, 8 Nov 2004 11:06:35 +0000 (11:06 +0000)
committerColin Leroy <colin@colino.net>
Mon, 8 Nov 2004 11:06:35 +0000 (11:06 +0000)
* src/textview.c
o Use text cursor instead of arrow when
  not on a link
o Fix handling of contiguous links (as in
  "colin@colino.net" <colin@colino.net>)
  This one unveils a bug in get_email_part()

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/textview.c

index d7b12a750510449b8d26602f2a0b11c4deb09987..8465c8bc7935dd1b260c9b8f955c06b17b1619f0 100644 (file)
@@ -1,3 +1,12 @@
+2004-11-08 [colin]     0.9.12cvs140.3
+
+       * src/textview.c
+               o Use text cursor instead of arrow when
+                 not on a link
+               o Fix handling of contiguous links (as in
+                 "colin@colino.net" <colin@colino.net>)
+                 This one unveils a bug in get_email_part()
+
 2004-11-07 [colin]     0.9.12cvs140.2
 
        * src/textview.c
index f76a79c9e4245c35ebfb3c2fb1d206a740a97587..0770934c3c5914e0553b2f03727463cdd859a7d6 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.100.2.5 -r 1.100.2.6 AUTHORS; cvs diff -u -r 1.96.2.25 -r 1.96.2.26 src/textview.c; cvs diff -u -r 1.12.2.2 -r 1.12.2.3 src/textview.h; ) > 0.9.12cvs139.2.patchset
 ( cvs diff -u -r 1.382.2.59 -r 1.382.2.60 src/compose.c; ) > 0.9.12cvs140.1.patchset
 ( cvs diff -u -r 1.96.2.26 -r 1.96.2.27 src/textview.c; ) > 0.9.12cvs140.2.patchset
+( cvs diff -u -r 1.96.2.27 -r 1.96.2.28 src/textview.c; ) > 0.9.12cvs140.3.patchset
index 075d9748e5ac11b077825698bc9080577b704f8f..8d9ba17e044311d91d5b24c0bf1c04147cee04f9 100644 (file)
@@ -13,7 +13,7 @@ INTERFACE_AGE=0
 BINARY_AGE=0
 EXTRA_VERSION=140
 EXTRA_RELEASE=
-EXTRA_GTK2_VERSION=.2
+EXTRA_GTK2_VERSION=.3
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION}
index 5859d57355d51b35eb0a7752b4c620b829209039..7b42c932245e8ba7d816f078a2de389c2fc10a35 100644 (file)
@@ -98,6 +98,7 @@ static GdkColor error_color = {
 
 
 static GdkCursor *hand_cursor = NULL;
+static GdkCursor *text_cursor = NULL;
 
 #define TEXTVIEW_STATUSBAR_PUSH(textview, str)                                     \
 {                                                                          \
@@ -242,6 +243,8 @@ TextView *textview_create(void)
 
        if (!hand_cursor)
                hand_cursor = gdk_cursor_new(GDK_HAND2);
+       if (!text_cursor)
+               text_cursor = gdk_cursor_new(GDK_XTERM);
 
        g_signal_connect(G_OBJECT(text), "key_press_event",
                         G_CALLBACK(textview_key_pressed),
@@ -1949,7 +1952,7 @@ static void textview_uri_update(TextView *textview, gint x, gint y)
                
                window = gtk_text_view_get_window(GTK_TEXT_VIEW(textview->text),
                                                  GTK_TEXT_WINDOW_TEXT);
-               gdk_window_set_cursor(window, uri ? hand_cursor : NULL);
+               gdk_window_set_cursor(window, uri ? hand_cursor : text_cursor);
 
                TEXTVIEW_STATUSBAR_POP(textview);
 
@@ -2000,21 +2003,33 @@ static RemoteURI *textview_get_uri_from_range(TextView *textview,
                                              GtkTextIter *start_iter,
                                              GtkTextIter *end_iter)
 {
-       gint start_pos, end_pos;
+       gint start_pos, end_pos, cur_pos;
        RemoteURI *uri = NULL;
        GSList *cur;
 
        start_pos = gtk_text_iter_get_offset(start_iter);
        end_pos = gtk_text_iter_get_offset(end_iter);
+       cur_pos = gtk_text_iter_get_offset(iter);
 
        for (cur = textview->uri_list; cur != NULL; cur = cur->next) {
                RemoteURI *uri_ = (RemoteURI *)cur->data;
-
                if (start_pos == uri_->start &&
                    end_pos ==  uri_->end) {
                        uri = uri_;
                        break;
-               }
+               } else if (start_pos == uri_->start ||
+                          end_pos == uri_->end) {
+                       /* in case of contiguous links, textview_get_uri_range
+                        * returns a broader range (start of 1st link to end
+                        * of last link).
+                        * In that case, correct link is the one covering
+                        * current iter.
+                        */
+                       if (uri_->start <= cur_pos && cur_pos <= uri_->end) {
+                               uri = uri_;
+                               break;
+                       }
+               } 
        }
 
        return uri;