aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/text
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-09-10 06:59:02 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-09-10 06:59:02 +0800
commite0cd01768a540ba9c4805fd03016dfa92dc48bd7 (patch)
treec18d09346e7fa3c4c7d34cd2683d36a3b349418c /widgets/text
parentadc1b15126a1f83d40ea5a66db79f1b55e0fbde6 (diff)
downloadgsoc2013-evolution-e0cd01768a540ba9c4805fd03016dfa92dc48bd7.tar.gz
gsoc2013-evolution-e0cd01768a540ba9c4805fd03016dfa92dc48bd7.tar.zst
gsoc2013-evolution-e0cd01768a540ba9c4805fd03016dfa92dc48bd7.zip
If our text shrinks, make sure that the selection doesn't spill off over
2001-09-09 Jon Trowbridge <trow@ximian.com> * gal/e-text/e-text.c (e_text_text_model_changed): If our text shrinks, make sure that the selection doesn't spill off over the end of the reduced buffer. (Related to bug #8535) svn path=/trunk/; revision=12717
Diffstat (limited to 'widgets/text')
-rw-r--r--widgets/text/e-text.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index b0dd3261e7..225fb610a7 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -519,9 +519,16 @@ e_text_destroy (GtkObject *object)
static void
e_text_text_model_changed (ETextModel *model, EText *text)
{
+ gint model_len = e_text_model_get_text_length (model);
text->text = e_text_model_get_text(model);
e_text_free_lines(text);
+
gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_CHANGED]);
+
+ /* Make sure our selection doesn't extend past the bounds of our text. */
+ text->selection_start = CLAMP (text->selection_start, 0, model_len);
+ text->selection_end = CLAMP (text->selection_end, 0, model_len);
+
text->needs_split_into_lines = 1;
e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(text));
}