gedit r6249 - in trunk: . gedit help help/C
- From: pborelli svn gnome org
- To: svn-commits-list gnome org
- Subject: gedit r6249 - in trunk: . gedit help help/C
- Date: Tue, 8 Apr 2008 12:10:34 +0100 (BST)
Author: pborelli
Date: Tue Apr 8 12:10:34 2008
New Revision: 6249
URL: http://svn.gnome.org/viewvc/gedit?rev=6249&view=rev
Log:
2008-04-08 Paolo Maggi <paolo gnome org>
* gedit/gedit-view.c (delete_line): if there is a selection, delete
the selected lines.
Modified:
trunk/ChangeLog
trunk/gedit/gedit-view.c
trunk/help/C/gedit.xml
trunk/help/ChangeLog
Modified: trunk/gedit/gedit-view.c
==============================================================================
--- trunk/gedit/gedit-view.c (original)
+++ trunk/gedit/gedit-view.c Tue Apr 8 12:10:34 2008
@@ -1893,7 +1893,6 @@
}
}
-
static void
delete_line (GtkTextView *text_view,
gint count)
@@ -1906,11 +1905,23 @@
reset_im_context (text_view);
- gtk_text_buffer_get_iter_at_mark (buffer, &start,
- gtk_text_buffer_get_insert (buffer));
-
+ /* If there is a selection delete the selected lines and
+ * ignore count */
+ if (gtk_text_buffer_get_selection_bounds (buffer, &start, &end))
+ {
+ gtk_text_iter_order (&start, &end);
+
+ if (gtk_text_iter_starts_line (&end))
+ {
+ /* Do no delete the line with the cursor if the cursor
+ * is at the beginning of the line */
+ count = 0;
+ }
+ else
+ count = 1;
+ }
+
gtk_text_iter_set_line_offset (&start, 0);
- end = start;
if (count > 0)
{
@@ -1926,7 +1937,7 @@
{
if (!gtk_text_iter_ends_line (&end))
gtk_text_iter_forward_to_line_end (&end);
-
+
while (count < 0)
{
if (!gtk_text_iter_backward_line (&start))
@@ -1934,7 +1945,7 @@
++count;
}
-
+
if (count == 0)
{
if (!gtk_text_iter_ends_line (&start))
@@ -1952,14 +1963,14 @@
gtk_text_buffer_begin_user_action (buffer);
gtk_text_buffer_place_cursor (buffer, &cur);
-
+
gtk_text_buffer_delete_interactive (buffer,
&start,
&end,
gtk_text_view_get_editable (text_view));
gtk_text_buffer_end_user_action (buffer);
-
+
gtk_text_view_scroll_mark_onscreen (text_view,
gtk_text_buffer_get_insert (buffer));
}
Modified: trunk/help/C/gedit.xml
==============================================================================
--- trunk/help/C/gedit.xml (original)
+++ trunk/help/C/gedit.xml Tue Apr 8 12:10:34 2008
@@ -985,6 +985,10 @@
<entry><para>Ctrl + A</para></entry>
<entry><para>Select all.</para></entry>
</row>
+ <row valign="top">
+ <entry><para>Ctrl + D</para></entry>
+ <entry><para>Delete current line.</para></entry>
+ </row>
</tbody>
</tgroup>
</informaltable>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]