Branch: refs/heads/master Author: Tim Coalson coalsont@users.noreply.github.com Committer: GitHub noreply@github.com Date: Fri, 20 Jan 2023 17:27:32 UTC Commit: d54b2a899dca95639fa6f52d5e16034498c332d9 https://github.com/geany/geany/commit/d54b2a899dca95639fa6f52d5e16034498c332...
Log Message: ----------- Add preference for backspace unindenting (#3355)
Modified Paths: -------------- data/geany.glade doc/geany.txt src/editor.c src/editor.h src/keyfile.c
Modified: data/geany.glade 16 lines changed, 16 insertions(+), 0 deletions(-) =================================================================== @@ -3293,6 +3293,22 @@ <property name="position">1</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="check_backspace_unindent"> + <property name="label" translatable="yes">_Backspace key unindents</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="tooltip-text" translatable="yes">With the cursor in the indentation, pressing backspace unindents instead of deleting one character</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + </packing> + </child> </object> </child> </object>
Modified: doc/geany.txt 5 lines changed, 5 insertions(+), 0 deletions(-) =================================================================== @@ -2176,6 +2176,11 @@ Tab key indents unindent, but this preference allows the tab key to have different meanings in different contexts - e.g. for snippet completion.
+Backspace key unindents + If set, pressing backspace while the cursor is in leading whitespace + will reduce the indentation level, unless the indentation mode is tabs. + Otherwise, the backspace key will delete the character before the cursor. + Editor Completions preferences ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Modified: src/editor.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -4689,7 +4689,7 @@ void editor_set_indent(GeanyEditor *editor, GeanyIndentType type, gint width) SSM(sci, SCI_SETINDENT, width, 0);
/* remove indent spaces on backspace, if using any spaces to indent */ - SSM(sci, SCI_SETBACKSPACEUNINDENTS, type != GEANY_INDENT_TYPE_TABS, 0); + SSM(sci, SCI_SETBACKSPACEUNINDENTS, editor_prefs.backspace_unindent && (type != GEANY_INDENT_TYPE_TABS), 0); }
Modified: src/editor.h 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -115,6 +115,7 @@ typedef struct GeanyEditorPrefs gboolean unfold_all_children; gboolean disable_dnd; gboolean use_tab_to_indent; /* makes tab key indent instead of insert a tab char */ + gboolean backspace_unindent; /* makes backspace char unindent instead of deleting one char */ gboolean smart_home_key; gboolean newline_strip; gboolean auto_complete_symbols;
Modified: src/keyfile.c 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -255,6 +255,8 @@ static void init_pref_groups(void) "detect_indent_width", FALSE, "check_detect_indent_width"); stash_group_add_toggle_button(group, &editor_prefs.use_tab_to_indent, "use_tab_to_indent", TRUE, "check_tab_key_indents"); + stash_group_add_toggle_button(group, &editor_prefs.backspace_unindent, + "backspace_unindent", TRUE, "check_backspace_unindent"); stash_group_add_spin_button_integer(group, &editor_prefs.indentation->width, "pref_editor_tab_width", 4, "spin_indent_width"); stash_group_add_combo_box(group, (gint*)(void*)&editor_prefs.indentation->auto_indent_mode,
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).