mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 13:11:13 +00:00
Merging release_1_0 changes into the main tree.
-timj Tue Mar 10 14:24:09 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkselection.c (gtk_selection_clear): Make the return result reflect whether the clear event was out of data. * gtk/gtkeditable.c: Ignore out of date selection clear events. * gtk/gtkentry.c gtk/gtktext.c: Don't synthesize releases on [2/3]BUTTON presses, since we get the normal click as well. Claim the selection when selecting words/lines. Tue Mar 10 13:34:29 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkrange.c (gtk_range_default_[vh]trough_click): Take forward/back step arrows into account when computing position for middle button clicks. * gtk/gtktext.c gtk/gtkentry.c: - Fixes for deleting characters (don't subtract guints and get negative numbers!) - Reset cursor_virtual_x when moving by words and lines - Extra sanity checks - Fix to gtk_text_get_chars (from Tony Gale <gale@daedalus.dera.gov.uk>)
This commit is contained in:
parent
120df3b8b7
commit
cb6412978c
27
ChangeLog
27
ChangeLog
@ -1,3 +1,30 @@
|
||||
Tue Mar 10 14:24:09 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkselection.c (gtk_selection_clear): Make the return
|
||||
result reflect whether the clear event was out of data.
|
||||
|
||||
* gtk/gtkeditable.c: Ignore out of date selection clear
|
||||
events.
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktext.c: Don't synthesize releases
|
||||
on [2/3]BUTTON presses, since we get the normal click as well.
|
||||
|
||||
Claim the selection when selecting words/lines.
|
||||
|
||||
Tue Mar 10 13:34:29 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkrange.c (gtk_range_default_[vh]trough_click):
|
||||
Take forward/back step arrows into account when computing
|
||||
position for middle button clicks.
|
||||
|
||||
* gtk/gtktext.c gtk/gtkentry.c:
|
||||
- Fixes for deleting characters (don't subtract guints and get
|
||||
negative numbers!)
|
||||
- Reset cursor_virtual_x when moving by words and lines
|
||||
- Extra sanity checks
|
||||
- Fix to gtk_text_get_chars
|
||||
(from Tony Gale <gale@daedalus.dera.gov.uk>)
|
||||
|
||||
1998-03-10 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* gdk/gdkgc.c (gdk_gc_set_function): Replace GXor by GXxor. Seems
|
||||
|
@ -1,3 +1,30 @@
|
||||
Tue Mar 10 14:24:09 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkselection.c (gtk_selection_clear): Make the return
|
||||
result reflect whether the clear event was out of data.
|
||||
|
||||
* gtk/gtkeditable.c: Ignore out of date selection clear
|
||||
events.
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktext.c: Don't synthesize releases
|
||||
on [2/3]BUTTON presses, since we get the normal click as well.
|
||||
|
||||
Claim the selection when selecting words/lines.
|
||||
|
||||
Tue Mar 10 13:34:29 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkrange.c (gtk_range_default_[vh]trough_click):
|
||||
Take forward/back step arrows into account when computing
|
||||
position for middle button clicks.
|
||||
|
||||
* gtk/gtktext.c gtk/gtkentry.c:
|
||||
- Fixes for deleting characters (don't subtract guints and get
|
||||
negative numbers!)
|
||||
- Reset cursor_virtual_x when moving by words and lines
|
||||
- Extra sanity checks
|
||||
- Fix to gtk_text_get_chars
|
||||
(from Tony Gale <gale@daedalus.dera.gov.uk>)
|
||||
|
||||
1998-03-10 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* gdk/gdkgc.c (gdk_gc_set_function): Replace GXor by GXxor. Seems
|
||||
|
@ -1,3 +1,30 @@
|
||||
Tue Mar 10 14:24:09 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkselection.c (gtk_selection_clear): Make the return
|
||||
result reflect whether the clear event was out of data.
|
||||
|
||||
* gtk/gtkeditable.c: Ignore out of date selection clear
|
||||
events.
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktext.c: Don't synthesize releases
|
||||
on [2/3]BUTTON presses, since we get the normal click as well.
|
||||
|
||||
Claim the selection when selecting words/lines.
|
||||
|
||||
Tue Mar 10 13:34:29 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkrange.c (gtk_range_default_[vh]trough_click):
|
||||
Take forward/back step arrows into account when computing
|
||||
position for middle button clicks.
|
||||
|
||||
* gtk/gtktext.c gtk/gtkentry.c:
|
||||
- Fixes for deleting characters (don't subtract guints and get
|
||||
negative numbers!)
|
||||
- Reset cursor_virtual_x when moving by words and lines
|
||||
- Extra sanity checks
|
||||
- Fix to gtk_text_get_chars
|
||||
(from Tony Gale <gale@daedalus.dera.gov.uk>)
|
||||
|
||||
1998-03-10 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* gdk/gdkgc.c (gdk_gc_set_function): Replace GXor by GXxor. Seems
|
||||
|
@ -1,3 +1,30 @@
|
||||
Tue Mar 10 14:24:09 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkselection.c (gtk_selection_clear): Make the return
|
||||
result reflect whether the clear event was out of data.
|
||||
|
||||
* gtk/gtkeditable.c: Ignore out of date selection clear
|
||||
events.
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktext.c: Don't synthesize releases
|
||||
on [2/3]BUTTON presses, since we get the normal click as well.
|
||||
|
||||
Claim the selection when selecting words/lines.
|
||||
|
||||
Tue Mar 10 13:34:29 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkrange.c (gtk_range_default_[vh]trough_click):
|
||||
Take forward/back step arrows into account when computing
|
||||
position for middle button clicks.
|
||||
|
||||
* gtk/gtktext.c gtk/gtkentry.c:
|
||||
- Fixes for deleting characters (don't subtract guints and get
|
||||
negative numbers!)
|
||||
- Reset cursor_virtual_x when moving by words and lines
|
||||
- Extra sanity checks
|
||||
- Fix to gtk_text_get_chars
|
||||
(from Tony Gale <gale@daedalus.dera.gov.uk>)
|
||||
|
||||
1998-03-10 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* gdk/gdkgc.c (gdk_gc_set_function): Replace GXor by GXxor. Seems
|
||||
|
@ -1,3 +1,30 @@
|
||||
Tue Mar 10 14:24:09 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkselection.c (gtk_selection_clear): Make the return
|
||||
result reflect whether the clear event was out of data.
|
||||
|
||||
* gtk/gtkeditable.c: Ignore out of date selection clear
|
||||
events.
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktext.c: Don't synthesize releases
|
||||
on [2/3]BUTTON presses, since we get the normal click as well.
|
||||
|
||||
Claim the selection when selecting words/lines.
|
||||
|
||||
Tue Mar 10 13:34:29 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkrange.c (gtk_range_default_[vh]trough_click):
|
||||
Take forward/back step arrows into account when computing
|
||||
position for middle button clicks.
|
||||
|
||||
* gtk/gtktext.c gtk/gtkentry.c:
|
||||
- Fixes for deleting characters (don't subtract guints and get
|
||||
negative numbers!)
|
||||
- Reset cursor_virtual_x when moving by words and lines
|
||||
- Extra sanity checks
|
||||
- Fix to gtk_text_get_chars
|
||||
(from Tony Gale <gale@daedalus.dera.gov.uk>)
|
||||
|
||||
1998-03-10 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* gdk/gdkgc.c (gdk_gc_set_function): Replace GXor by GXxor. Seems
|
||||
|
@ -1,3 +1,30 @@
|
||||
Tue Mar 10 14:24:09 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkselection.c (gtk_selection_clear): Make the return
|
||||
result reflect whether the clear event was out of data.
|
||||
|
||||
* gtk/gtkeditable.c: Ignore out of date selection clear
|
||||
events.
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktext.c: Don't synthesize releases
|
||||
on [2/3]BUTTON presses, since we get the normal click as well.
|
||||
|
||||
Claim the selection when selecting words/lines.
|
||||
|
||||
Tue Mar 10 13:34:29 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkrange.c (gtk_range_default_[vh]trough_click):
|
||||
Take forward/back step arrows into account when computing
|
||||
position for middle button clicks.
|
||||
|
||||
* gtk/gtktext.c gtk/gtkentry.c:
|
||||
- Fixes for deleting characters (don't subtract guints and get
|
||||
negative numbers!)
|
||||
- Reset cursor_virtual_x when moving by words and lines
|
||||
- Extra sanity checks
|
||||
- Fix to gtk_text_get_chars
|
||||
(from Tony Gale <gale@daedalus.dera.gov.uk>)
|
||||
|
||||
1998-03-10 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* gdk/gdkgc.c (gdk_gc_set_function): Replace GXor by GXxor. Seems
|
||||
|
@ -1,3 +1,30 @@
|
||||
Tue Mar 10 14:24:09 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkselection.c (gtk_selection_clear): Make the return
|
||||
result reflect whether the clear event was out of data.
|
||||
|
||||
* gtk/gtkeditable.c: Ignore out of date selection clear
|
||||
events.
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktext.c: Don't synthesize releases
|
||||
on [2/3]BUTTON presses, since we get the normal click as well.
|
||||
|
||||
Claim the selection when selecting words/lines.
|
||||
|
||||
Tue Mar 10 13:34:29 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkrange.c (gtk_range_default_[vh]trough_click):
|
||||
Take forward/back step arrows into account when computing
|
||||
position for middle button clicks.
|
||||
|
||||
* gtk/gtktext.c gtk/gtkentry.c:
|
||||
- Fixes for deleting characters (don't subtract guints and get
|
||||
negative numbers!)
|
||||
- Reset cursor_virtual_x when moving by words and lines
|
||||
- Extra sanity checks
|
||||
- Fix to gtk_text_get_chars
|
||||
(from Tony Gale <gale@daedalus.dera.gov.uk>)
|
||||
|
||||
1998-03-10 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* gdk/gdkgc.c (gdk_gc_set_function): Replace GXor by GXxor. Seems
|
||||
|
@ -298,7 +298,8 @@ gtk_editable_selection_clear (GtkWidget *widget,
|
||||
|
||||
/* Let the selection handling code know that the selection
|
||||
* has been changed, since we've overriden the default handler */
|
||||
gtk_selection_clear (widget, event);
|
||||
if (!gtk_selection_clear (widget, event))
|
||||
return FALSE;
|
||||
|
||||
editable = GTK_EDITABLE (widget);
|
||||
|
||||
@ -317,7 +318,7 @@ gtk_editable_selection_clear (GtkWidget *widget,
|
||||
editable->clipboard_text = NULL;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -97,8 +97,10 @@ static void gtk_delete_forward_word (GtkEntry *entry);
|
||||
static void gtk_delete_backward_word (GtkEntry *entry);
|
||||
static void gtk_delete_line (GtkEntry *entry);
|
||||
static void gtk_delete_to_line_end (GtkEntry *entry);
|
||||
static void gtk_select_word (GtkEntry *entry);
|
||||
static void gtk_select_line (GtkEntry *entry);
|
||||
static void gtk_select_word (GtkEntry *entry,
|
||||
guint32 time);
|
||||
static void gtk_select_line (GtkEntry *entry,
|
||||
guint32 time);
|
||||
|
||||
|
||||
static void gtk_entry_set_selection (GtkEditable *editable,
|
||||
@ -705,7 +707,7 @@ gtk_entry_button_press (GtkWidget *widget,
|
||||
entry = GTK_ENTRY (widget);
|
||||
editable = GTK_EDITABLE (widget);
|
||||
|
||||
if (entry->button)
|
||||
if (entry->button && (event->type == GDK_BUTTON_PRESS))
|
||||
{
|
||||
GdkEventButton release_event = *event;
|
||||
|
||||
@ -736,11 +738,11 @@ gtk_entry_button_press (GtkWidget *widget,
|
||||
break;
|
||||
|
||||
case GDK_2BUTTON_PRESS:
|
||||
gtk_select_word (entry);
|
||||
gtk_select_word (entry, event->time);
|
||||
break;
|
||||
|
||||
case GDK_3BUTTON_PRESS:
|
||||
gtk_select_line (entry);
|
||||
gtk_select_line (entry, event->time);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1424,9 +1426,12 @@ gtk_entry_insert_text (GtkEditable *editable,
|
||||
new_text_length = entry->text_max_length - entry->text_length;
|
||||
|
||||
/* Don't insert anything, if there was nothing to insert. */
|
||||
if (new_text_length <= 0)
|
||||
if (new_text_length == 0)
|
||||
return;
|
||||
|
||||
if (new_text_length < 0)
|
||||
new_text_length = strlen (new_text);
|
||||
|
||||
start_pos = *position;
|
||||
end_pos = start_pos + new_text_length;
|
||||
last_pos = new_text_length + entry->text_length;
|
||||
@ -1523,14 +1528,19 @@ gtk_entry_get_chars (GtkEditable *editable,
|
||||
start_pos = MIN(entry->text_length, start_pos);
|
||||
end_pos = MIN(entry->text_length, end_pos);
|
||||
|
||||
c = entry->text[end_pos];
|
||||
entry->text[end_pos] = '\0';
|
||||
|
||||
retval = g_strdup (&entry->text[start_pos]);
|
||||
|
||||
entry->text[end_pos] = c;
|
||||
|
||||
return retval;
|
||||
if (start_pos <= end_pos)
|
||||
{
|
||||
c = entry->text[end_pos];
|
||||
entry->text[end_pos] = '\0';
|
||||
|
||||
retval = g_strdup (&entry->text[start_pos]);
|
||||
|
||||
entry->text[end_pos] = c;
|
||||
|
||||
return retval;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1767,7 +1777,7 @@ gtk_delete_to_line_end (GtkEntry *entry)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_select_word (GtkEntry *entry)
|
||||
gtk_select_word (GtkEntry *entry, guint32 time)
|
||||
{
|
||||
gint start_pos;
|
||||
gint end_pos;
|
||||
@ -1781,16 +1791,21 @@ gtk_select_word (GtkEntry *entry)
|
||||
gtk_move_forward_word (entry);
|
||||
end_pos = editable->current_pos;
|
||||
|
||||
editable->has_selection = TRUE;
|
||||
gtk_entry_set_selection (editable, start_pos, end_pos);
|
||||
gtk_editable_claim_selection (editable, start_pos != end_pos, time);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_select_line (GtkEntry *entry)
|
||||
gtk_select_line (GtkEntry *entry, guint32 time)
|
||||
{
|
||||
GtkEditable *editable;
|
||||
editable = GTK_EDITABLE (entry);
|
||||
|
||||
editable->has_selection = TRUE;
|
||||
gtk_entry_set_selection (editable, 0, entry->text_length);
|
||||
gtk_editable_claim_selection (editable, entry->text_length != 0, time);
|
||||
|
||||
editable->current_pos = editable->selection_end_pos;
|
||||
}
|
||||
|
||||
|
@ -387,33 +387,36 @@ gtk_range_default_htrough_click (GtkRange *range,
|
||||
gint y,
|
||||
gfloat *jump_perc)
|
||||
{
|
||||
gint xthickness;
|
||||
gint ythickness;
|
||||
gint trough_width;
|
||||
gint trough_height;
|
||||
gint slider_x;
|
||||
gint slider_length;
|
||||
gint left, right;
|
||||
|
||||
g_return_val_if_fail (range != NULL, GTK_TROUGH_NONE);
|
||||
g_return_val_if_fail (GTK_IS_RANGE (range), GTK_TROUGH_NONE);
|
||||
|
||||
xthickness = GTK_WIDGET (range)->style->klass->xthickness;
|
||||
ythickness = GTK_WIDGET (range)->style->klass->ythickness;
|
||||
|
||||
if ((x > xthickness) && (y > ythickness))
|
||||
gtk_range_trough_hdims (range, &left, &right);
|
||||
gdk_window_get_size (range->slider, &slider_length, NULL);
|
||||
right += slider_length;
|
||||
|
||||
if ((x > left) && (y > ythickness))
|
||||
{
|
||||
gdk_window_get_size (range->trough, &trough_width, &trough_height);
|
||||
|
||||
if ((x < (trough_width - xthickness) && (y < (trough_height - ythickness))))
|
||||
if ((x < right) && (y < (trough_height - ythickness)))
|
||||
{
|
||||
gdk_window_get_position (range->slider, &slider_x, NULL);
|
||||
|
||||
if (jump_perc)
|
||||
{
|
||||
*jump_perc = ((double) x) / ((double) trough_width);
|
||||
|
||||
*jump_perc = ((gdouble) (x - left)) / ((gdouble) (right - left));
|
||||
return GTK_TROUGH_JUMP;
|
||||
}
|
||||
|
||||
gdk_window_get_position (range->slider, &slider_x, NULL);
|
||||
|
||||
if (x < slider_x)
|
||||
return GTK_TROUGH_START;
|
||||
else
|
||||
@ -431,32 +434,36 @@ gtk_range_default_vtrough_click (GtkRange *range,
|
||||
gfloat *jump_perc)
|
||||
{
|
||||
gint xthickness;
|
||||
gint ythickness;
|
||||
gint trough_width;
|
||||
gint trough_height;
|
||||
gint slider_y;
|
||||
gint top, bottom;
|
||||
gint slider_length;
|
||||
|
||||
g_return_val_if_fail (range != NULL, GTK_TROUGH_NONE);
|
||||
g_return_val_if_fail (GTK_IS_RANGE (range), GTK_TROUGH_NONE);
|
||||
|
||||
xthickness = GTK_WIDGET (range)->style->klass->xthickness;
|
||||
ythickness = GTK_WIDGET (range)->style->klass->ythickness;
|
||||
|
||||
if ((x > xthickness) && (y > ythickness))
|
||||
gtk_range_trough_vdims (range, &top, &bottom);
|
||||
gdk_window_get_size (range->slider, NULL, &slider_length);
|
||||
bottom += slider_length;
|
||||
|
||||
if ((x > xthickness) && (y > top))
|
||||
{
|
||||
gdk_window_get_size (range->trough, &trough_width, &trough_height);
|
||||
|
||||
if ((x < (trough_width - xthickness) && (y < (trough_height - ythickness))))
|
||||
if ((x < (trough_width - xthickness) && (y < bottom)))
|
||||
{
|
||||
gdk_window_get_position (range->slider, NULL, &slider_y);
|
||||
|
||||
if (jump_perc)
|
||||
{
|
||||
*jump_perc = ((double) y) / ((double) trough_height);
|
||||
*jump_perc = ((gdouble) (y - top)) / ((gdouble) (bottom - top));
|
||||
|
||||
return GTK_TROUGH_JUMP;
|
||||
}
|
||||
|
||||
gdk_window_get_position (range->slider, NULL, &slider_y);
|
||||
|
||||
if (y < slider_y)
|
||||
return GTK_TROUGH_START;
|
||||
else
|
||||
|
@ -630,7 +630,7 @@ gtk_selection_clear (GtkWidget *widget,
|
||||
}
|
||||
|
||||
if (tmp_list == NULL || selection_info->time > event->time)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
|
||||
current_selections = g_list_remove_link (current_selections, tmp_list);
|
||||
g_list_free (tmp_list);
|
||||
|
@ -294,8 +294,10 @@ static void gtk_text_delete_forward_word (GtkText *text);
|
||||
static void gtk_text_delete_backward_word (GtkText *text);
|
||||
static void gtk_text_delete_line (GtkText *text);
|
||||
static void gtk_text_delete_to_line_end (GtkText *text);
|
||||
static void gtk_text_select_word (GtkText *text);
|
||||
static void gtk_text_select_line (GtkText *text);
|
||||
static void gtk_text_select_word (GtkText *text,
|
||||
guint32 time);
|
||||
static void gtk_text_select_line (GtkText *text,
|
||||
guint32 time);
|
||||
|
||||
/* #define DEBUG_GTK_TEXT */
|
||||
|
||||
@ -781,7 +783,7 @@ gtk_text_forward_delete (GtkText *text,
|
||||
|
||||
if (text->point.index < text->first_line_start_index)
|
||||
{
|
||||
if (text->point.index >= text->first_line_start_index - nchars)
|
||||
if (text->point.index + nchars >= text->first_line_start_index)
|
||||
{
|
||||
text->first_line_start_index = text->point.index;
|
||||
while ((text->first_line_start_index > 0) &&
|
||||
@ -794,13 +796,15 @@ gtk_text_forward_delete (GtkText *text,
|
||||
}
|
||||
|
||||
if (text->point.index < editable->selection_start_pos)
|
||||
editable->selection_start_pos -= nchars;
|
||||
editable->selection_start_pos -=
|
||||
MIN(nchars, editable->selection_start_pos - text->point.index);
|
||||
if (text->point.index < editable->selection_end_pos)
|
||||
editable->selection_end_pos -= nchars;
|
||||
editable->selection_end_pos -=
|
||||
MIN(nchars, editable->selection_end_pos - text->point.index);
|
||||
/* We'll reset the cursor later anyways if we aren't frozen */
|
||||
if (text->point.index < text->cursor_mark.index)
|
||||
text->cursor_mark.index -= nchars;
|
||||
|
||||
text->cursor_mark.index -=
|
||||
MIN(nchars, text->cursor_mark.index - text->point.index);
|
||||
|
||||
move_gap_to_point (text);
|
||||
|
||||
@ -828,14 +832,14 @@ gtk_text_get_chars (GtkEditable *editable,
|
||||
gchar *p;
|
||||
guint n, nchars;
|
||||
|
||||
if (end_pos < 0)
|
||||
end_pos = TEXT_LENGTH (text);
|
||||
|
||||
g_return_val_if_fail (editable != NULL, NULL);
|
||||
g_return_val_if_fail (GTK_IS_TEXT (editable), NULL);
|
||||
text = GTK_TEXT (editable);
|
||||
|
||||
if (end_pos > TEXT_LENGTH (text))
|
||||
if (end_pos < 0)
|
||||
end_pos = TEXT_LENGTH (text);
|
||||
|
||||
if ((end_pos > TEXT_LENGTH (text)) || (end_pos < start_pos))
|
||||
return NULL;
|
||||
|
||||
nchars = end_pos - start_pos;
|
||||
@ -1344,7 +1348,7 @@ gtk_text_button_press (GtkWidget *widget,
|
||||
text = GTK_TEXT (widget);
|
||||
editable = GTK_EDITABLE (widget);
|
||||
|
||||
if (text->button)
|
||||
if (text->button && (event->type == GDK_BUTTON_PRESS))
|
||||
{
|
||||
GdkEventButton release_event = *event;
|
||||
|
||||
@ -1380,11 +1384,11 @@ gtk_text_button_press (GtkWidget *widget,
|
||||
break;
|
||||
|
||||
case GDK_2BUTTON_PRESS:
|
||||
gtk_text_select_word (text);
|
||||
gtk_text_select_word (text, event->time);
|
||||
break;
|
||||
|
||||
case GDK_3BUTTON_PRESS:
|
||||
gtk_text_select_line (text);
|
||||
gtk_text_select_line (text, event->time);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1585,7 +1589,8 @@ gtk_text_delete_text (GtkEditable *editable,
|
||||
if (end_pos < 0)
|
||||
end_pos = TEXT_LENGTH (text);
|
||||
|
||||
gtk_text_forward_delete (text, end_pos - start_pos);
|
||||
if (end_pos > start_pos)
|
||||
gtk_text_forward_delete (text, end_pos - start_pos);
|
||||
}
|
||||
|
||||
static gint
|
||||
@ -2033,10 +2038,14 @@ static void
|
||||
fetch_lines_backward (GtkText* text)
|
||||
{
|
||||
GList* new_lines = NULL, *new_line_start;
|
||||
GtkPropertyMark mark;
|
||||
|
||||
GtkPropertyMark mark = find_this_line_start_mark (text,
|
||||
CACHE_DATA(text->line_start_cache).start.index - 1,
|
||||
&CACHE_DATA(text->line_start_cache).start);
|
||||
if (CACHE_DATA(text->line_start_cache).start.index == 0)
|
||||
return;
|
||||
|
||||
mark = find_this_line_start_mark (text,
|
||||
CACHE_DATA(text->line_start_cache).start.index - 1,
|
||||
&CACHE_DATA(text->line_start_cache).start);
|
||||
|
||||
new_line_start = new_lines = fetch_lines (text, &mark, NULL, FetchLinesCount, 1);
|
||||
|
||||
@ -2092,7 +2101,7 @@ compute_lines_pixels (GtkText* text, guint char_count,
|
||||
if (line == text->current_line)
|
||||
chars_left -= CACHE_DATA(line).end.index - text->point.index + 1;
|
||||
else
|
||||
chars_left -= CACHE_DATA(line).end.index -CACHE_DATA(line).start.index + 1;
|
||||
chars_left -= CACHE_DATA(line).end.index - CACHE_DATA(line).start.index + 1;
|
||||
|
||||
if (!text->line_wrap || !CACHE_DATA(line).wraps)
|
||||
*lines += 1;
|
||||
@ -2591,7 +2600,7 @@ insert_text_property (GtkText* text, GdkFont* font,
|
||||
forward_prop->length += len;
|
||||
}
|
||||
else if ((MARK_NEXT_LIST_PTR(mark) == NULL) &&
|
||||
(MARK_OFFSET(mark) == forward_prop->length - 1))
|
||||
(MARK_OFFSET(mark) + 1 == forward_prop->length))
|
||||
{
|
||||
/* Inserting before only the last position in the text */
|
||||
|
||||
@ -3306,6 +3315,8 @@ gtk_text_move_previous_line (GtkText *text)
|
||||
static void
|
||||
gtk_text_move_forward_word (GtkText *text)
|
||||
{
|
||||
text->cursor_virtual_x = 0;
|
||||
|
||||
undraw_cursor (text, FALSE);
|
||||
|
||||
while (!LAST_INDEX (text, text->cursor_mark) &&
|
||||
@ -3323,6 +3334,8 @@ gtk_text_move_forward_word (GtkText *text)
|
||||
static void
|
||||
gtk_text_move_backward_word (GtkText *text)
|
||||
{
|
||||
text->cursor_virtual_x = 0;
|
||||
|
||||
undraw_cursor (text, FALSE);
|
||||
|
||||
while ((text->cursor_mark.index > 0) &&
|
||||
@ -3340,6 +3353,8 @@ gtk_text_move_backward_word (GtkText *text)
|
||||
static void
|
||||
gtk_text_move_beginning_of_line (GtkText *text)
|
||||
{
|
||||
text->cursor_virtual_x = 0;
|
||||
|
||||
undraw_cursor (text, FALSE);
|
||||
|
||||
while ((text->cursor_mark.index > 0) &&
|
||||
@ -3353,6 +3368,8 @@ gtk_text_move_beginning_of_line (GtkText *text)
|
||||
static void
|
||||
gtk_text_move_end_of_line (GtkText *text)
|
||||
{
|
||||
text->cursor_virtual_x = 0;
|
||||
|
||||
undraw_cursor (text, FALSE);
|
||||
|
||||
while (!LAST_INDEX (text, text->cursor_mark) &&
|
||||
@ -3473,7 +3490,7 @@ gtk_text_delete_to_line_end (GtkText *text)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_select_word (GtkText *text)
|
||||
gtk_text_select_word (GtkText *text, guint32 time)
|
||||
{
|
||||
gint start_pos;
|
||||
gint end_pos;
|
||||
@ -3487,11 +3504,13 @@ gtk_text_select_word (GtkText *text)
|
||||
gtk_text_move_forward_word (text);
|
||||
end_pos = text->cursor_mark.index;
|
||||
|
||||
editable->has_selection = TRUE;
|
||||
gtk_text_set_selection (editable, start_pos, end_pos);
|
||||
gtk_editable_claim_selection (editable, start_pos != end_pos, time);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_select_line (GtkText *text)
|
||||
gtk_text_select_line (GtkText *text, guint32 time)
|
||||
{
|
||||
gint start_pos;
|
||||
gint end_pos;
|
||||
@ -3506,7 +3525,9 @@ gtk_text_select_line (GtkText *text)
|
||||
gtk_text_move_forward_character (text);
|
||||
end_pos = text->cursor_mark.index;
|
||||
|
||||
editable->has_selection = TRUE;
|
||||
gtk_text_set_selection (editable, start_pos, end_pos);
|
||||
gtk_editable_claim_selection (editable, start_pos != end_pos, time);
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
@ -4453,10 +4474,13 @@ gtk_text_update_text (GtkEditable *editable,
|
||||
GdkRectangle area;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
|
||||
if (end_pos < 0)
|
||||
end_pos = TEXT_LENGTH (text);
|
||||
|
||||
if (end_pos < start_pos)
|
||||
return;
|
||||
|
||||
gdk_window_get_size (text->text_area, &width, &height);
|
||||
area.x = 0;
|
||||
area.y = -1;
|
||||
|
Loading…
Reference in New Issue
Block a user