diff options
author | Matthias Clasen <maclas@gmx.de> | 2002-12-25 21:02:25 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2002-12-25 21:02:25 +0000 |
commit | 657c65ed4bef8fd16049197163151e33722b8b5a (patch) | |
tree | 3f7cb9fc29be391166be7d6965c283c91c623612 /gtk | |
parent | 783239524314e48d2d1ee908394d9e4416279037 (diff) | |
download | gtk+-657c65ed4bef8fd16049197163151e33722b8b5a.tar.gz |
Fix highlighting of selection wrt. to empty lines. (#90435, #90582)
2002-12-25 Matthias Clasen <maclas@gmx.de>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix highlighting of
selection wrt. to empty lines. (#90435, #90582)
* gtk/gtktextview.c (gtk_text_view_preedit_changed_handler):
Keep the cursor on screen. (#96929)
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtktextdisplay.c | 5 | ||||
-rw-r--r-- | gtk/gtktextview.c | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c index e531a46526..4be120d80c 100644 --- a/gtk/gtktextdisplay.c +++ b/gtk/gtktextdisplay.c @@ -803,7 +803,8 @@ gtk_text_layout_draw (GtkTextLayout *layout, &line_start, line, 0); line_end = line_start; - gtk_text_iter_forward_to_line_end (&line_end); + if (!gtk_text_iter_ends_line (&line_end)) + 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 && @@ -817,7 +818,7 @@ gtk_text_layout_draw (GtkTextLayout *layout, if (gtk_text_iter_compare (&selection_end, &line_end) <= 0) selection_end_index = gtk_text_iter_get_line_index (&selection_end); else - selection_end_index = byte_count; + selection_end_index = MAX(byte_count, 1); } } diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 138c38a273..9530cc674f 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -6191,9 +6191,12 @@ gtk_text_view_preedit_changed_handler (GtkIMContext *context, gtk_im_context_get_preedit_string (context, &str, &attrs, &cursor_pos); gtk_text_layout_set_preedit_string (text_view->layout, str, attrs, cursor_pos); - pango_attr_list_unref (attrs); g_free (str); + + gtk_text_view_scroll_mark_onscreen (text_view, + gtk_text_buffer_get_mark (get_buffer (text_view), + "insert")); } static gboolean |