projects
/
modest
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
83a3771
)
Remove the infinite loops that were causing the application hang
modest-3-0
author
Jose Dapena Paz
<jdapena@igalia.com>
Wed, 7 Oct 2009 08:45:49 +0000
(10:45 +0200)
committer
Jose Dapena Paz
<jdapena@igalia.com>
Wed, 7 Oct 2009 08:45:49 +0000
(10:45 +0200)
(fixes NB#141003).
src/widgets/modest-recpt-editor.c
patch
|
blob
|
history
diff --git
a/src/widgets/modest-recpt-editor.c
b/src/widgets/modest-recpt-editor.c
index
706e96f
..
548a238
100644
(file)
--- a/
src/widgets/modest-recpt-editor.c
+++ b/
src/widgets/modest-recpt-editor.c
@@
-911,11
+911,12
@@
modest_recpt_editor_on_key_press_event (GtkTextView *text_view,
{
gboolean cursor_ready = FALSE;
GtkTextIter prev_location;
{
gboolean cursor_ready = FALSE;
GtkTextIter prev_location;
+ gboolean moved = TRUE;
prev_location = location;
while (!cursor_ready) {
prev_location = location;
while (!cursor_ready) {
- if (iter_previous_char (&location) == '\n') {
- gtk_text_iter_backward_char (&location);
+ if (moved && (iter_previous_char (&location) == '\n')) {
+ moved = gtk_text_iter_backward_char (&location);
} else {
cursor_ready = TRUE;
}
} else {
cursor_ready = TRUE;
}
@@
-925,15
+926,16
@@
modest_recpt_editor_on_key_press_event (GtkTextView *text_view,
gtk_text_iter_backward_to_tag_toggle (&prev_location, tag);
location = prev_location;
cursor_ready = FALSE;
gtk_text_iter_backward_to_tag_toggle (&prev_location, tag);
location = prev_location;
cursor_ready = FALSE;
- while (!cursor_ready) {
+ moved = TRUE;
+ while (moved && !cursor_ready) {
if (iter_previous_char (&location) == '\n') {
if (iter_previous_char (&location) == '\n') {
- gtk_text_iter_backward_char (&location);
+ moved = gtk_text_iter_backward_char (&location);
} else {
cursor_ready = TRUE;
}
}
}
} else {
cursor_ready = TRUE;
}
}
}
-
+
if ((tag != NULL)&& (gtk_text_iter_is_start (&location) || !(gtk_text_iter_begins_tag (&location, tag)))) {
if (has_selection) {
gtk_text_buffer_select_range (buffer, &location, &location);
if ((tag != NULL)&& (gtk_text_iter_is_start (&location) || !(gtk_text_iter_begins_tag (&location, tag)))) {
if (has_selection) {
gtk_text_buffer_select_range (buffer, &location, &location);
@@
-967,12
+969,14
@@
modest_recpt_editor_on_key_press_event (GtkTextView *text_view,
case GDK_KP_Right:
{
gboolean cursor_moved = FALSE;
case GDK_KP_Right:
{
gboolean cursor_moved = FALSE;
+ gboolean moved = TRUE;
tag = iter_has_recipient (&location);
if ((tag != NULL)&&(!gtk_text_iter_ends_tag (&location, tag))) {
gtk_text_iter_forward_to_tag_toggle (&location, tag);
tag = iter_has_recipient (&location);
if ((tag != NULL)&&(!gtk_text_iter_ends_tag (&location, tag))) {
gtk_text_iter_forward_to_tag_toggle (&location, tag);
- while (gtk_text_iter_get_char (&location) == '\n')
- gtk_text_iter_forward_char (&location);
+ moved = TRUE;
+ while (moved && (gtk_text_iter_get_char (&location) == '\n'))
+ moved = gtk_text_iter_forward_char (&location);
gtk_text_buffer_place_cursor (buffer, &location);
gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (text_view), insert, 0.0, FALSE, 0.0, 1.0);
gtk_text_buffer_place_cursor (buffer, &location);
gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (text_view), insert, 0.0, FALSE, 0.0, 1.0);
@@
-982,14
+986,17
@@
modest_recpt_editor_on_key_press_event (GtkTextView *text_view,
return TRUE;
}
return TRUE;
}
- while (gtk_text_iter_get_char (&location) == '\n') {
- gtk_text_iter_forward_char (&location);
+ moved = TRUE;
+ while (moved && (gtk_text_iter_get_char (&location) == '\n')) {
+ moved = gtk_text_iter_forward_char (&location);
cursor_moved = TRUE;
}
if (!cursor_moved)
gtk_text_iter_forward_char (&location);
cursor_moved = TRUE;
}
if (!cursor_moved)
gtk_text_iter_forward_char (&location);
- while (gtk_text_iter_get_char (&location) == '\n') {
- gtk_text_iter_forward_char (&location);
+
+ moved = TRUE;
+ while (moved && (gtk_text_iter_get_char (&location) == '\n')) {
+ moved = gtk_text_iter_forward_char (&location);
cursor_moved = TRUE;
}
cursor_moved = TRUE;
}