~ubuntu-branches/ubuntu/precise/gtksourceview2/precise-proposed

« back to all changes in this revision

Viewing changes to gtksourceview/gtksourceview.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-04-28 15:09:35 UTC
  • mfrom: (1.1.40 upstream) (6.2.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100428150935-4hrru472bmm1ierx
Tags: 2.10.1-0ubuntu1
* New upstream version (lp: #571261):
  - Improvements to some of the lang files
  - Misc bugfixes
  - Updated translations

Show diffs side-by-side

added added

removed removed

Lines of Context:
1219
1219
        gtk_text_buffer_get_selection_bounds (buf, &start, &end);
1220
1220
 
1221
1221
        line_end = *line_start;
1222
 
        gtk_text_iter_forward_to_line_end (&line_end);
 
1222
 
 
1223
        if (!gtk_text_iter_ends_line (&line_end))
 
1224
                gtk_text_iter_forward_to_line_end (&line_end);
1223
1225
 
1224
1226
        if (gtk_text_iter_compare (&start, line_start) < 0)
1225
1227
        {
4099
4101
        gtk_text_buffer_delete_mark (buf, mark);
4100
4102
}
4101
4103
 
4102
 
static void
4103
 
remove_previous_line_if_empty (GtkSourceView *view,
4104
 
                               GtkTextIter   *iter)
4105
 
{
4106
 
        GtkTextBuffer *buf;
4107
 
        GtkTextIter start;
4108
 
        gunichar c;
4109
 
        
4110
 
        start = *iter;
4111
 
        
4112
 
        while (TRUE)
4113
 
        {
4114
 
                gtk_text_iter_backward_char (&start);
4115
 
                
4116
 
                if (gtk_text_iter_starts_line (&start))
4117
 
                        break;
4118
 
        
4119
 
                c = gtk_text_iter_get_char (&start);
4120
 
                
4121
 
                if (!g_unichar_isspace (c))
4122
 
                        return;
4123
 
        }
4124
 
        
4125
 
        buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
4126
 
        
4127
 
        gtk_text_buffer_delete (buf, &start, iter);
4128
 
}
4129
 
 
4130
4104
static gboolean
4131
4105
gtk_source_view_key_press_event (GtkWidget   *widget,
4132
4106
                                 GdkEventKey *event)
4181
4155
 
4182
4156
                        /* Insert new line and auto-indent. */
4183
4157
                        gtk_text_buffer_begin_user_action (buf);
4184
 
                        remove_previous_line_if_empty (view, &cur);
4185
4158
                        gtk_text_buffer_insert (buf, &cur, "\n", 1);
4186
4159
                        gtk_text_buffer_insert (buf, &cur, indent, strlen (indent));
4187
4160
                        g_free (indent);