[geany/geany] d8f532: add 'folding margin width setting' (#2140)

Andy Alt git-noreply at xxxxx
Mon Jun 22 02:45:26 UTC 2020


Branch:      refs/heads/master
Author:      Andy Alt <andy5995 at users.noreply.github.com>
Committer:   GitHub <noreply at github.com>
Date:        Mon, 22 Jun 2020 02:45:26 UTC
Commit:      d8f532b5adf41ae57b99b6ac95d336401ba15e35
             https://github.com/geany/geany/commit/d8f532b5adf41ae57b99b6ac95d336401ba15e35

Log Message:
-----------
add 'folding margin width setting' (#2140)


Modified Paths:
--------------
    data/filedefs/filetypes.common
    src/editor.c
    src/highlighting.c
    src/sciwrappers.c
    src/sciwrappers.h

Modified: data/filedefs/filetypes.common
3 lines changed, 3 insertions(+), 0 deletions(-)
===================================================================
@@ -19,6 +19,9 @@ margin_linenumber=margin_line_number
 margin_folding=margin_folding
 fold_symbol_highlight=fold_symbol_highlight
 
+# width of the folding margin on the right of the line numbers
+folding_margin_width=12
+
 # background colour of the current line, only the second and third argument is interpreted
 # use the third argument to enable or disable the highlighting of the current line (has to be true/false)
 current_line=current_line


Modified: src/editor.c
2 lines changed, 0 insertions(+), 2 deletions(-)
===================================================================
@@ -5189,8 +5189,6 @@ void editor_apply_update_prefs(GeanyEditor *editor)
 	sci_set_symbol_margin(sci, editor_prefs.show_markers_margin);
 	sci_set_line_numbers(sci, editor_prefs.show_linenumber_margin);
 
-	sci_set_folding_margin_visible(sci, editor_prefs.folding);
-
 	/* virtual space */
 	SSM(sci, SCI_SETVIRTUALSPACEOPTIONS, editor_prefs.show_virtual_space, 0);
 


Modified: src/highlighting.c
21 lines changed, 21 insertions(+), 0 deletions(-)
===================================================================
@@ -96,6 +96,7 @@ enum	/* Geany common styling */
 	GCS_LINE_HEIGHT,
 	GCS_CALLTIPS,
 	GCS_INDICATOR_ERROR,
+	GCS_FOLDING_MARGIN_WIDTH,
 	GCS_MAX
 };
 
@@ -564,6 +565,8 @@ static void styleset_common_init(GKeyFile *config, GKeyFile *config_home)
 		1, 1, &common_style_set.fold_marker, &common_style_set.fold_lines);
 	get_keyfile_ints(config, config_home, "styling", "folding_horiz_line",
 		2, 0, &common_style_set.fold_draw_line, NULL);
+	get_keyfile_ints(config, config_home, "styling", "folding_margin_width",
+		1, 0, &common_style_set.styling[GCS_FOLDING_MARGIN_WIDTH].background, NULL);
 	get_keyfile_ints(config, config_home, "styling", "caret_width",
 		1, 0, &common_style_set.styling[GCS_CARET].background, NULL); /* caret.foreground used earlier */
 	get_keyfile_int(config, config_home, "styling", "line_wrap_visuals",
@@ -805,6 +808,22 @@ static void styleset_common(ScintillaObject *sci, guint ft_id)
 }
 
 
+/* folding margin visibility */
+static void set_folding_margin_visible(ScintillaObject *sci, gboolean set)
+{
+	if (set)
+	{
+		SSM(sci, SCI_SETMARGINWIDTHN, 2, common_style_set.styling[GCS_FOLDING_MARGIN_WIDTH].background);
+		SSM(sci, SCI_SETMARGINSENSITIVEN, 2, TRUE);
+	}
+	else
+	{
+		SSM(sci, SCI_SETMARGINSENSITIVEN, 2, FALSE);
+		SSM(sci, SCI_SETMARGINWIDTHN, 2, 0);
+	}
+}
+
+
 /* Merge & assign global typedefs and user secondary keywords.
  * keyword_idx is used for both style_sets[].keywords and scintilla keyword style number */
 static void merge_type_keywords(ScintillaObject *sci, guint ft_id, guint keyword_idx)
@@ -880,6 +899,8 @@ static void styleset_from_mapping(ScintillaObject *sci, guint ft_id, guint lexer
 		}
 	}
 
+	set_folding_margin_visible(sci, editor_prefs.folding);
+
 	/* keywords */
 	foreach_range(i, n_keywords)
 	{


Modified: src/sciwrappers.c
16 lines changed, 0 insertions(+), 16 deletions(-)
===================================================================
@@ -160,22 +160,6 @@ void sci_set_symbol_margin(ScintillaObject *sci, gboolean set)
 }
 
 
-/* folding margin visibility */
-void sci_set_folding_margin_visible(ScintillaObject *sci, gboolean set)
-{
-	if (set)
-	{
-		SSM(sci, SCI_SETMARGINWIDTHN, 2, 12);
-		SSM(sci, SCI_SETMARGINSENSITIVEN, 2, TRUE);
-	}
-	else
-	{
-		SSM(sci, SCI_SETMARGINSENSITIVEN, 2, FALSE);
-		SSM(sci, SCI_SETMARGINWIDTHN, 2, 0);
-	}
-}
-
-
 /* end of lines */
 void sci_set_visible_eols(ScintillaObject *sci, gboolean set)
 {


Modified: src/sciwrappers.h
1 lines changed, 0 insertions(+), 1 deletions(-)
===================================================================
@@ -157,7 +157,6 @@ void 				sci_toggle_fold				(ScintillaObject *sci, gint line);
 gint				sci_get_fold_level			(ScintillaObject *sci, gint line);
 gint				sci_get_fold_parent			(ScintillaObject *sci, gint start_line);
 
-void 				sci_set_folding_margin_visible (ScintillaObject *sci, gboolean set);
 gboolean			sci_get_fold_expanded		(ScintillaObject *sci, gint line);
 
 void				sci_colourise				(ScintillaObject *sci, gint start, gint end);



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list