[geany/geany] a59954: Show marker margin in split window

Nick Treleaven git-noreply at xxxxx
Thu Jul 26 00:02:20 UTC 2012


Branch:      refs/heads/document-messages
Author:      Nick Treleaven <nick.treleaven at btinternet.com>
Committer:   Nick Treleaven <nick.treleaven at btinternet.com>
Date:        Mon, 19 Dec 2011 18:23:46
Commit:      a5995468efcab38c4812de4ac4e7e6396477b481
             https://github.com/geany/geany/commit/a5995468efcab38c4812de4ac4e7e6396477b481

Log Message:
-----------
Show marker margin in split window

Although go to marker commands (or other keybindings) don't work, the
marker margin can still be useful, and improves alignment with the
original sci widget when using the Top & Bottom split.


Modified Paths:
--------------
    plugins/splitwindow.c

Modified: plugins/splitwindow.c
28 files changed, 23 insertions(+), 5 deletions(-)
===================================================================
@@ -105,16 +105,32 @@ static void set_line_numbers(ScintillaObject * sci, gboolean set)
 }
 
 
-static void on_sci_notify(ScintillaObject *sci, gint param, SCNotification *notif, gpointer data)
+static void on_sci_notify(ScintillaObject *sci, gint param,
+		SCNotification *nt, gpointer data)
 {
 	gint line;
 
-	switch (notif->nmhdr.code)
+	switch (nt->nmhdr.code)
 	{
+		/* adapted from editor.c: on_margin_click() */
 		case SCN_MARGINCLICK:
-			if (notif->margin == 2)
+			/* left click to marker margin toggles marker */
+			if (nt->margin == 1)
 			{
-				line = sci_get_line_from_position(sci, notif->position);
+				gboolean set;
+				gint marker = 1;
+
+				line = sci_get_line_from_position(sci, nt->position);
+				set = sci_is_marker_set_at_line(sci, line, marker);
+				if (!set)
+					sci_set_marker_at_line(sci, line, marker);
+				else
+					sci_delete_marker_at_line(sci, line, marker);
+			}
+			/* left click on the folding margin to toggle folding state of current line */
+			if (nt->margin == 2)
+			{
+				line = sci_get_line_from_position(sci, nt->position);
 				scintilla_send_message(sci, SCI_TOGGLEFOLD, line, 0);
 			}
 			break;
@@ -139,7 +155,9 @@ static void sync_to_current(ScintillaObject *sci, ScintillaObject *current)
 
 	/* override some defaults */
 	set_line_numbers(sci, geany->editor_prefs->show_linenumber_margin);
-	scintilla_send_message(sci, SCI_SETMARGINWIDTHN, 1, 0 ); /* hide marker margin (no commands) */
+	/* marker margin */
+	scintilla_send_message(sci, SCI_SETMARGINWIDTHN, 1,
+		scintilla_send_message(current, SCI_GETMARGINWIDTHN, 1, 0));
 	if (!geany->editor_prefs->folding)
 		scintilla_send_message(sci, SCI_SETMARGINWIDTHN, 2, 0);
 }


@@ Diff output truncated at 100000 characters. @@


--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).



More information about the Commits mailing list