[gnome-builder] plugins/editorui: give more control over smart-home-end



commit fa812d68bce327d2dc865c24be3695f0d2b025fd
Author: Christian Hergert <chergert redhat com>
Date:   Tue Aug 23 16:40:45 2022 -0700

    plugins/editorui: give more control over smart-home-end
    
    Both fixes the missing smart-home-end setting and gives more control over
    it to users with a combo/choice tweak.
    
    Fixes #1761

 .../gsettings/org.gnome.builder.editor.gschema.xml | 14 +++++++---
 src/libide/editor/ide-editor-page-settings.c       |  3 +++
 src/plugins/editorui/tweaks.ui                     | 31 +++++++++++++++++++---
 3 files changed, 41 insertions(+), 7 deletions(-)
---
diff --git a/data/gsettings/org.gnome.builder.editor.gschema.xml 
b/data/gsettings/org.gnome.builder.editor.gschema.xml
index 39d60da27..04861bfd9 100644
--- a/data/gsettings/org.gnome.builder.editor.gschema.xml
+++ b/data/gsettings/org.gnome.builder.editor.gschema.xml
@@ -54,10 +54,16 @@
       <summary>Smart Backspace</summary>
       <description>Backspace will remove additional spaces to keep you aligned to the indentation 
size.</description>
     </key>
-    <key name="smart-home-end" type="b">
-      <default>true</default>
-      <summary>Smart Home and End</summary>
-      <description>Whether or not Home moves to first non-space character.</description>
+    <key name="smart-home-end" type="s">
+      <choices>
+        <choice value="disabled"/>
+        <choice value="before"/>
+        <choice value="after"/>
+        <choice value="always"/>
+      </choices>
+      <default>'before'</default>
+      <summary>Smart Home/End</summary>
+      <description>Modifies the behavior of Home/End keys.</description>
     </key>
     <key name="show-grid-lines" type="b">
       <default>false</default>
diff --git a/src/libide/editor/ide-editor-page-settings.c b/src/libide/editor/ide-editor-page-settings.c
index 2cc582196..1595fa04e 100644
--- a/src/libide/editor/ide-editor-page-settings.c
+++ b/src/libide/editor/ide-editor-page-settings.c
@@ -208,6 +208,9 @@ _ide_editor_page_settings_init (IdeEditorPage *self)
   g_settings_bind (editor_settings, "line-height",
                    self->view, "line-height",
                    G_SETTINGS_BIND_GET);
+  g_settings_bind (editor_settings, "smart-home-end",
+                   self->view, "smart-home-end",
+                   G_SETTINGS_BIND_GET);
 
   g_settings_bind_with_mapping (editor_settings, "font-name",
                                 self->view, "font-desc",
diff --git a/src/plugins/editorui/tweaks.ui b/src/plugins/editorui/tweaks.ui
index a1b97265a..73a433688 100644
--- a/src/plugins/editorui/tweaks.ui
+++ b/src/plugins/editorui/tweaks.ui
@@ -332,10 +332,35 @@
                           </object>
                         </child>
                         <child>
-                          <object class="IdeTweaksSwitch" id="smart_home_end">
+                          <object class="IdeTweaksCombo" id="smart_home_end">
                             <property name="title" translatable="yes">Smart Home/End</property>
-                            <property name="subtitle" translatable="yes">Moves to first non-whitespace 
character before line edges</property>
-                            <property 
name="action-name">settings.org.gnome.builder.editor.smart-home-end</property>
+                            <property name="subtitle" translatable="yes">Navigate to non-space 
characters</property>
+                            <property name="settings">settings_org_gnome_builder_editor</property>
+                            <property name="key">smart-home-end</property>
+                            <child>
+                              <object class="IdeTweaksChoice">
+                                <property name="title" translatable="yes">Before line boundaries</property>
+                                <property name="action-target">'before'</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="IdeTweaksChoice">
+                                <property name="title" translatable="yes">After line boundaries</property>
+                                <property name="action-target">'after'</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="IdeTweaksChoice">
+                                <property name="title" translatable="yes">Instead of line 
boundaries</property>
+                                <property name="action-target">'always'</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="IdeTweaksChoice">
+                                <property name="title" translatable="yes">Disabled</property>
+                                <property name="action-target">'disabled'</property>
+                              </object>
+                            </child>
                           </object>
                         </child>
                       </object>


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