fix to properly replace selection with Return or Tab
2001-11-13 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_key_press_event): fix to properly replace selection with Return or Tab * gtk/gtktextdisplay.c (gtk_text_layout_draw): fix broken code that didn't locate the end of the line correctly, should fix #63800
This commit is contained in:

committed by
Havoc Pennington

parent
10b3db0836
commit
8befd2f822
@ -1,3 +1,11 @@
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_key_press_event): fix to
|
||||
properly replace selection with Return or Tab
|
||||
|
||||
* gtk/gtktextdisplay.c (gtk_text_layout_draw): fix broken code
|
||||
that didn't locate the end of the line correctly, should fix #63800
|
||||
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_size_request): add border width
|
||||
|
@ -1,3 +1,11 @@
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_key_press_event): fix to
|
||||
properly replace selection with Return or Tab
|
||||
|
||||
* gtk/gtktextdisplay.c (gtk_text_layout_draw): fix broken code
|
||||
that didn't locate the end of the line correctly, should fix #63800
|
||||
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_size_request): add border width
|
||||
|
@ -1,3 +1,11 @@
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_key_press_event): fix to
|
||||
properly replace selection with Return or Tab
|
||||
|
||||
* gtk/gtktextdisplay.c (gtk_text_layout_draw): fix broken code
|
||||
that didn't locate the end of the line correctly, should fix #63800
|
||||
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_size_request): add border width
|
||||
|
@ -1,3 +1,11 @@
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_key_press_event): fix to
|
||||
properly replace selection with Return or Tab
|
||||
|
||||
* gtk/gtktextdisplay.c (gtk_text_layout_draw): fix broken code
|
||||
that didn't locate the end of the line correctly, should fix #63800
|
||||
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_size_request): add border width
|
||||
|
@ -1,3 +1,11 @@
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_key_press_event): fix to
|
||||
properly replace selection with Return or Tab
|
||||
|
||||
* gtk/gtktextdisplay.c (gtk_text_layout_draw): fix broken code
|
||||
that didn't locate the end of the line correctly, should fix #63800
|
||||
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_size_request): add border width
|
||||
|
@ -1,3 +1,11 @@
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_key_press_event): fix to
|
||||
properly replace selection with Return or Tab
|
||||
|
||||
* gtk/gtktextdisplay.c (gtk_text_layout_draw): fix broken code
|
||||
that didn't locate the end of the line correctly, should fix #63800
|
||||
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_size_request): add border width
|
||||
|
@ -1,3 +1,11 @@
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_key_press_event): fix to
|
||||
properly replace selection with Return or Tab
|
||||
|
||||
* gtk/gtktextdisplay.c (gtk_text_layout_draw): fix broken code
|
||||
that didn't locate the end of the line correctly, should fix #63800
|
||||
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_size_request): add border width
|
||||
|
@ -785,12 +785,9 @@ gtk_text_layout_draw (GtkTextLayout *layout,
|
||||
gtk_text_layout_get_iter_at_line (layout,
|
||||
&line_start,
|
||||
line, 0);
|
||||
byte_count = gtk_text_iter_get_bytes_in_line (&line_start);
|
||||
|
||||
/* FIXME the -1 assumes a newline I think */
|
||||
gtk_text_layout_get_iter_at_line (layout,
|
||||
&line_end,
|
||||
line, byte_count - 1);
|
||||
line_end = line_start;
|
||||
gtk_text_iter_forward_to_line_end (&line_end);
|
||||
byte_count = gtk_text_iter_get_line_index (&line_end);
|
||||
|
||||
if (gtk_text_iter_compare (&selection_start, &line_end) <= 0 &&
|
||||
gtk_text_iter_compare (&selection_end, &line_start) >= 0)
|
||||
|
@ -262,6 +262,8 @@ static void gtk_text_view_value_changed (GtkAdjustment *adj,
|
||||
static void gtk_text_view_commit_handler (GtkIMContext *context,
|
||||
const gchar *str,
|
||||
GtkTextView *text_view);
|
||||
static void gtk_text_view_commit_text (GtkTextView *text_view,
|
||||
const gchar *text);
|
||||
static void gtk_text_view_preedit_changed_handler (GtkIMContext *context,
|
||||
GtkTextView *text_view);
|
||||
static gboolean gtk_text_view_retrieve_surrounding_handler (GtkIMContext *context,
|
||||
@ -3377,13 +3379,7 @@ gtk_text_view_key_press_event (GtkWidget *widget, GdkEventKey *event)
|
||||
else if (event->keyval == GDK_Return ||
|
||||
event->keyval == GDK_KP_Enter)
|
||||
{
|
||||
gtk_text_buffer_insert_interactive_at_cursor (get_buffer (text_view), "\n", 1,
|
||||
text_view->editable);
|
||||
DV(g_print (G_STRLOC": scrolling to mark\n"));
|
||||
gtk_text_view_scroll_to_mark (text_view,
|
||||
gtk_text_buffer_get_mark (get_buffer (text_view),
|
||||
"insert"),
|
||||
0.0, FALSE, 0.0, 0.0);
|
||||
gtk_text_view_commit_text (text_view, "\n");
|
||||
retval = TRUE;
|
||||
}
|
||||
/* Pass through Tab as literal tab, unless Control is held down */
|
||||
@ -3392,12 +3388,7 @@ gtk_text_view_key_press_event (GtkWidget *widget, GdkEventKey *event)
|
||||
event->keyval == GDK_ISO_Left_Tab) &&
|
||||
!(event->state & GDK_CONTROL_MASK))
|
||||
{
|
||||
gtk_text_buffer_insert_interactive_at_cursor (get_buffer (text_view), "\t", 1,
|
||||
text_view->editable);
|
||||
DV(g_print (G_STRLOC": scrolling onscreen\n"));
|
||||
gtk_text_view_scroll_mark_onscreen (text_view,
|
||||
gtk_text_buffer_get_mark (get_buffer (text_view),
|
||||
"insert"));
|
||||
gtk_text_view_commit_text (text_view, "\t");
|
||||
retval = TRUE;
|
||||
}
|
||||
else
|
||||
@ -5385,6 +5376,13 @@ static void
|
||||
gtk_text_view_commit_handler (GtkIMContext *context,
|
||||
const gchar *str,
|
||||
GtkTextView *text_view)
|
||||
{
|
||||
gtk_text_view_commit_text (text_view, str);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_commit_text (GtkTextView *text_view,
|
||||
const gchar *str)
|
||||
{
|
||||
gboolean had_selection;
|
||||
|
||||
|
Reference in New Issue
Block a user