[gnome-text-editor] sourceview: add support to delete the current line



commit d6ffee46065b097600a15365064a8f2f189b8405
Author: Christian Hergert <chergert redhat com>
Date:   Thu Sep 30 09:06:20 2021 -0700

    sourceview: add support to delete the current line
    
    Using <control>d like we use in Builder (by default) and gedit.
    
    Fixes #163

 src/editor-source-view.c | 4 ++++
 src/help-overlay.ui      | 6 ++++++
 2 files changed, 10 insertions(+)
---
diff --git a/src/editor-source-view.c b/src/editor-source-view.c
index 6327bd1..b65c442 100644
--- a/src/editor-source-view.c
+++ b/src/editor-source-view.c
@@ -429,6 +429,10 @@ editor_source_view_class_init (EditorSourceViewClass *klass)
   gtk_widget_class_add_binding_action (widget_class, GDK_KEY_minus, GDK_CONTROL_MASK, "page.zoom-out", NULL);
   gtk_widget_class_add_binding_action (widget_class, GDK_KEY_KP_Subtract, GDK_CONTROL_MASK, "page.zoom-out", 
NULL);
   gtk_widget_class_add_binding_action (widget_class, GDK_KEY_0, GDK_CONTROL_MASK, "page.zoom-one", NULL);
+
+  gtk_widget_class_add_binding_signal (widget_class,
+                                       GDK_KEY_d, GDK_CONTROL_MASK,
+                                       "delete-from-cursor", "(ii)", GTK_DELETE_PARAGRAPHS, 1);
 }
 
 static void
diff --git a/src/help-overlay.ui b/src/help-overlay.ui
index f57514d..91070ef 100644
--- a/src/help-overlay.ui
+++ b/src/help-overlay.ui
@@ -295,6 +295,12 @@
                 <property name="title" translatable="yes" context="shortcut window">Delete from cursor to 
paragraph end</property>
               </object>
             </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="accelerator">&lt;ctrl&gt;d</property>
+                <property name="title" translatable="yes" context="shortcut window">Delete the current 
line</property>
+              </object>
+            </child>
           </object>
         </child>
       </object>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]