[geany/geany] 243599: Show selected line count on status bar when whole lines are selected

Nick Treleaven git-noreply at xxxxx
Thu Jul 26 00:04:06 UTC 2012


Branch:      refs/heads/document-messages
Author:      Nick Treleaven <nick.treleaven at btinternet.com>
Committer:   Nick Treleaven <nick.treleaven at btinternet.com>
Date:        Sun, 22 Apr 2012 16:32:53
Commit:      24359942bfe96d37c76cccfc3e9993ec83e912d1
             https://github.com/geany/geany/commit/24359942bfe96d37c76cccfc3e9993ec83e912d1

Log Message:
-----------
Show selected line count on status bar when whole lines are selected


Modified Paths:
--------------
    src/ui_utils.c

Modified: src/ui_utils.c
15 files changed, 13 insertions(+), 2 deletions(-)
===================================================================
@@ -178,6 +178,7 @@ static void add_statusbar_statistics(GString *stats_str,
 	const gchar *fmt;
 	const gchar *expos;	/* % expansion position */
 	const gchar sp[] = "      ";
+	ScintillaObject *sci = doc->editor->sci;
 
 	fmt = NZV(statusbar_template) ? statusbar_template :
 		/* Status bar statistics: col = column, sel = selection. */
@@ -206,9 +207,19 @@ static void add_statusbar_statistics(GString *stats_str,
 				g_string_append_printf(stats_str, "%d", col + 1);
 				break;
 			case 's':
-				g_string_append_printf(stats_str, "%d",
-					sci_get_selected_text_length(doc->editor->sci) - 1);
+			{
+				gint len = sci_get_selected_text_length(sci) - 1;
+				/* check if whole lines are selected */
+				if (!len || sci_get_col_from_position(sci,
+						sci_get_selection_start(sci)) != 0 ||
+					sci_get_col_from_position(sci,
+						sci_get_selection_end(sci)) != 0)
+					g_string_append_printf(stats_str, "%d", len);
+				else /* L = lines */
+					g_string_append_printf(stats_str, _("%dL"),
+						sci_get_lines_selected(doc->editor->sci) - 1);
 				break;
+			}
 			case 'w':
 				/* RO = read-only */
 				g_string_append(stats_str, (doc->readonly) ? _("RO ") :


@@ 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