Author: jhs
Date: Sun Feb 17 14:57:58 2008
New Revision: 3684
URL: http://svn.gnome.org/viewvc/anjuta?rev=3684&view=rev

Log:
2008-02-17  Johannes Schmid <[EMAIL PROTECTED]>

        * plugins/sourceview/anjuta-view.c: (anjuta_view_key_press_event):
        * plugins/sourceview/sourceview-cell.c: (icell_get_character),
        (icell_get_char):
        * plugins/sourceview/sourceview.c: (on_insert_text):    
        Fix \"char-added\" signal to pass the correct iterator

Modified:
   trunk/ChangeLog
   trunk/plugins/sourceview/anjuta-view.c
   trunk/plugins/sourceview/sourceview-cell.c
   trunk/plugins/sourceview/sourceview.c

Modified: trunk/plugins/sourceview/anjuta-view.c
==============================================================================
--- trunk/plugins/sourceview/anjuta-view.c      (original)
+++ trunk/plugins/sourceview/anjuta-view.c      Sun Feb 17 14:57:58 2008
@@ -729,6 +729,7 @@
        GtkTextBuffer *buffer;
        AnjutaView* view = ANJUTA_VIEW(widget);
        AssistWindow* assist_win;
+       AssistTip* assist_tip;
        
        buffer  = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
        
@@ -741,6 +742,15 @@
                        return TRUE;
                }
        }
+       assist_tip = view->priv->sv->priv->assist_tip;
+       if (assist_tip)
+       {
+               if (event->keyval == GDK_Escape)
+               {
+                       gtk_widget_destroy 
(GTK_WIDGET(view->priv->sv->priv->assist_tip));
+                       return TRUE;
+               }
+       }
        return (* GTK_WIDGET_CLASS 
(anjuta_view_parent_class)->key_press_event)(widget, event);
 }
 

Modified: trunk/plugins/sourceview/sourceview-cell.c
==============================================================================
--- trunk/plugins/sourceview/sourceview-cell.c  (original)
+++ trunk/plugins/sourceview/sourceview-cell.c  Sun Feb 17 14:57:58 2008
@@ -99,11 +99,10 @@
 icell_get_character(IAnjutaEditorCell* icell, GError** e)
 {
        SourceviewCell* cell = SOURCEVIEW_CELL(icell);
-       GtkTextIter* clone = gtk_text_iter_copy (cell->priv->iter);
-       gchar* text = NULL;
-       if (gtk_text_iter_forward_char (clone))
-               text = gtk_text_iter_get_text (cell->priv->iter, clone);
-       return text;
+       gunichar c = gtk_text_iter_get_char (cell->priv->iter);
+       gchar* outbuf = g_new0(gchar, 6);
+       g_unichar_to_utf8 (c, outbuf);
+       return outbuf;
 }
 
 static gint 
@@ -120,12 +119,17 @@
 static gchar
 icell_get_char(IAnjutaEditorCell* icell, gint index, GError** e)
 {
-       gchar ch = '\0';
-       gchar* utf8 = icell_get_character(icell, NULL);
-       if (utf8 && (index == 0 || (strlen (utf8) > index)))
-               ch = utf8[index];       
-       g_free(utf8);
-       return ch;
+       SourceviewCell* cell = SOURCEVIEW_CELL(icell);
+       gunichar c = gtk_text_iter_get_char (cell->priv->iter);
+       gchar* outbuf = g_new0(gchar, 6);
+       gint len = g_unichar_to_utf8 (c, outbuf);
+       gchar retval;
+       if (index < len)
+               retval = outbuf[index];
+       else
+               retval = 0;
+       g_free (outbuf);
+       return retval;
 }
 
 static IAnjutaEditorAttribute

Modified: trunk/plugins/sourceview/sourceview.c
==============================================================================
--- trunk/plugins/sourceview/sourceview.c       (original)
+++ trunk/plugins/sourceview/sourceview.c       Sun Feb 17 14:57:58 2008
@@ -129,6 +129,7 @@
                return;
        else
        {
+               gtk_text_iter_backward_char (location);
                SourceviewCell* cell = sourceview_cell_new (location, 
                                                                                
                        GTK_TEXT_VIEW(sv->priv->view));
                g_signal_emit_by_name(G_OBJECT(sv), "char_added", cell, 
text[0]);
_______________________________________________
SVN-commits-list mailing list (read only)
http://mail.gnome.org/mailman/listinfo/svn-commits-list

Want to limit the commits to a few modules? Go to above URL, log in to edit 
your options and select the modules ('topics') you want.
Module maintainer? It is possible to set the reply-to to your development 
mailing list. Email [EMAIL PROTECTED] if interested.

Reply via email to