gtktext patch



i mentioned what needed doing a while back, but looking
at the web interface to the CVS stuff, i see no-one has
fixed the bugs whereby typing Tab or Enter doesn't cut
the selection in the way that typing anything else does.
here's a context diff showing my fix, which also adds the
gtk_text_clear function mentioned in the TODO file (i
needed it for something i was writing).

the .R versions correspond to the released gtk 1.2.3 source.

*** gtktext.h.R	Wed Feb 24 11:15:13 1999
--- gtktext.h	Fri Aug 13 17:26:41 1999
***************
*** 193,198 ****
--- 193,199 ----
  guint      gtk_text_get_length      (GtkText       *text);
  void       gtk_text_freeze          (GtkText       *text);
  void       gtk_text_thaw            (GtkText       *text);
+ void       gtk_text_clear           (GtkText       *text);
  void       gtk_text_insert          (GtkText       *text,
  				     GdkFont       *font,
  				     GdkColor      *fore,
*** gtktext.c.R	Tue May 11 04:31:09 1999
--- gtktext.c	Fri Aug 13 17:49:50 1999
***************
*** 919,924 ****
--- 919,936 ----
  }
  
  void
+ gtk_text_clear (GtkText *text)
+ {
+   g_return_if_fail (text != NULL);
+   g_return_if_fail (GTK_IS_TEXT (text));
+   
+   gtk_text_freeze (text);
+   gtk_editable_delete_text (GTK_EDITABLE (text),
+     0, gtk_text_get_length (text));
+   gtk_text_thaw (text);
+ }
+ 
+ void
  gtk_text_insert (GtkText    *text,
  		 GdkFont    *font,
  		 GdkColor   *fore,
***************
*** 2118,2123 ****
--- 2130,2137 ----
  	    gtk_text_delete_forward_character (text);
  	  break;
  	case GDK_Tab:
+ 	  extend_selection = FALSE;
+ 	  gtk_editable_delete_selection (editable);
  	  position = text->point.index;
  	  gtk_editable_insert_text (editable, "\t", 1, &position);
  	  break;
***************
*** 2126,2131 ****
--- 2140,2147 ----
  	    gtk_signal_emit_by_name (GTK_OBJECT (text), "activate");
  	  else
  	    {
+ 	      extend_selection = FALSE;
+ 	      gtk_editable_delete_selection (editable);
  	      position = text->point.index;
  	      gtk_editable_insert_text (editable, "\n", 1, &position);
  	    }

-- 
"Intelligence ... has caused our troubles; but it is not
 unintelligence that will cure them." -- Bertrand Russell



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]