summaryrefslogtreecommitdiff
path: root/gtk/gtkeditable.c
diff options
context:
space:
mode:
authorOwen Taylor <owt1@cornell.edu>1998-03-01 08:47:36 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-03-01 08:47:36 +0000
commit2630943eb30fb7a94680e7afb6e1d070718c9811 (patch)
tree205200c8e9a8f1f4986ed3117c150f332fb51bef /gtk/gtkeditable.c
parent9205edae41b7fdcdda29e8a47739c56f34834f0f (diff)
downloadgdk-pixbuf-2630943eb30fb7a94680e7afb6e1d070718c9811.tar.gz
gtk/gtkentry.[ch] gtk/gtktext.[ch] gtkeditable.[ch]
Sun Mar 1 03:20:39 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkentry.[ch] gtk/gtktext.[ch] gtkeditable.[ch] Turned off debugging in gtktext.c Bug fixes for cutting, pasting, deleting, etc. Some of the bugs that were there before have definitely been fixed. * gtk/testgtk.c gtk/testgtkrc: Removed my ugly orange backgrounds, to make things look nicer.
Diffstat (limited to 'gtk/gtkeditable.c')
-rw-r--r--gtk/gtkeditable.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/gtk/gtkeditable.c b/gtk/gtkeditable.c
index 93ec740ad..eba3d2675 100644
--- a/gtk/gtkeditable.c
+++ b/gtk/gtkeditable.c
@@ -53,9 +53,9 @@ typedef void (*GtkEditableSignal2) (GtkObject *object,
gpointer data);
typedef gpointer (*GtkEditableSignal3) (GtkObject *object,
- gint arg1,
- gint arg2,
- gpointer data);
+ gint arg1,
+ gint arg2,
+ gpointer data);
static void gtk_editable_marshal_signal_1 (GtkObject *object,
@@ -312,8 +312,8 @@ gtk_editable_finalize (GtkObject *object)
void
gtk_editable_insert_text (GtkEditable *editable,
const gchar *new_text,
- guint new_text_length,
- guint *position)
+ gint new_text_length,
+ gint *position)
{
gchar buf[64];
gchar *text;
@@ -338,8 +338,8 @@ gtk_editable_insert_text (GtkEditable *editable,
void
gtk_editable_delete_text (GtkEditable *editable,
- guint start_pos,
- guint end_pos)
+ gint start_pos,
+ gint end_pos)
{
g_return_if_fail (editable != NULL);
g_return_if_fail (GTK_IS_EDITABLE (editable));
@@ -363,8 +363,8 @@ gtk_editable_update_text (GtkEditable *editable,
gchar *
gtk_editable_get_chars (GtkEditable *editable,
- guint start,
- guint end)
+ gint start,
+ gint end)
{
gchar *retval = NULL;
@@ -444,7 +444,8 @@ gtk_editable_selection_handler (GtkWidget *widget,
{
selection_start_pos = MIN (editable->selection_start_pos, editable->selection_end_pos);
selection_end_pos = MAX (editable->selection_start_pos, editable->selection_end_pos);
- str = gtk_editable_get_chars(editable, selection_start_pos,
+ str = gtk_editable_get_chars(editable,
+ selection_start_pos,
selection_end_pos);
length = selection_end_pos - selection_start_pos;
}
@@ -576,14 +577,15 @@ gtk_editable_selection_received (GtkWidget *widget,
void
gtk_editable_delete_selection (GtkEditable *editable)
{
- if (editable->selection_start_pos != editable->selection_end_pos)
- gtk_editable_delete_text (editable,
- MIN (editable->selection_start_pos, editable->selection_end_pos),
- MAX (editable->selection_start_pos, editable->selection_end_pos));
+ guint start = editable->selection_start_pos;
+ guint end = editable->selection_end_pos;
editable->selection_start_pos = 0;
editable->selection_end_pos = 0;
+ if (start != end)
+ gtk_editable_delete_text (editable, MIN (start, end), MAX (start,end));
+
if (editable->has_selection)
{
editable->has_selection = FALSE;
@@ -614,8 +616,8 @@ gtk_editable_claim_selection (GtkEditable *editable,
void
gtk_editable_select_region (GtkEditable *editable,
- guint start,
- guint end)
+ gint start,
+ gint end)
{
if (GTK_WIDGET_REALIZED (editable))
gtk_editable_claim_selection (editable, start != end, GDK_CURRENT_TIME);
@@ -645,8 +647,8 @@ gtk_editable_copy_clipboard (GtkEditable *editable, GdkEventKey *event)
clipboard_atom,
event->time))
editable->clipboard_text = gtk_editable_get_chars (editable,
- editable->selection_start_pos,
- editable->selection_end_pos);
+ selection_start_pos,
+ selection_end_pos);
}
}