[geany/geany] f8fd93: join_lines: Remove excessive comments

Eugene Arshinov git-noreply at xxxxx
Sat Feb 25 15:55:24 UTC 2012


Branch:      refs/heads/master
Author:      Eugene Arshinov <earshinov at gmail.com>
Committer:   Eugene Arshinov <earshinov at gmail.com>
Date:        Sat, 25 Feb 2012 15:55:24
Commit:      f8fd93039b577a21819baa7722314612e25b94e9
             https://github.com/geany/geany/commit/f8fd93039b577a21819baa7722314612e25b94e9

Log Message:
-----------
join_lines: Remove excessive comments


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

Modified: src/keybindings.c
54 files changed, 6 insertions(+), 48 deletions(-)
===================================================================
@@ -2019,42 +2019,18 @@ static void join_lines(GeanyEditor *editor)
 	end = sci_get_line_from_position(editor->sci,
 		sci_get_selection_end(editor->sci));
 
-	/*
-	 * remove trailing spaces for every line except the last one
-	 * so that these spaces won't appear within text after joining
-	 */
+	/* remove spaces surrounding the lines so that these spaces
+	 * won't appear within text after joining */
 	for (i = start; i < end; i++)
 		editor_strip_line_trailing_spaces(editor, i);
-
-	/* remove starting spaces from second and following lines due to the same reason */
 	for (i = start + 1; i <= end; i++)
 		sci_set_line_indentation(editor->sci, i, 0);
 
-	/*
-	 * SCI_LINESJOIN automatically adds spaces between joined lines, including
-	 * empty ones. We should drop empty lines if we want only one space to be
-	 * inserted (see also example below). I don't think we should care of that.
-	 */
-
 	sci_set_target_start(editor->sci,
 		sci_get_position_from_line(editor->sci, start));
 	sci_set_target_end(editor->sci,
 		sci_get_position_from_line(editor->sci, end));
 	sci_lines_join(editor->sci);
-
-	/*
-	 * Example: joining
-	 *
-	 * [TAB]if (something_wrong)
-	 * [TAB]{
-	 * [TAB][TAB]
-	 * [TAB][TAB]exit(1);[SPACE][SPACE]
-	 * [TAB]}[SPACE]
-	 *
-	 * gives
-	 *
-	 * [TAB]if (something_wrong) {  exit(1); }[SPACE]
-	 */
 }
 
 
@@ -2062,20 +2038,11 @@ static gint get_reflow_column(GeanyEditor *editor)
 {
 	const GeanyEditorPrefs *eprefs = editor_get_prefs(editor);
 	if (editor->line_breaking)
-	{
-		/* use line break column if enabled */
 		return eprefs->line_break_column;
-	}
 	else if (eprefs->long_line_type != 2)
-	{
-		/* use long line if enabled */
 		return eprefs->long_line_column;
-	}
 	else
-	{
-		/* do nothing if no column is defined */
-		return -1;
-	}
+		return -1; /* do nothing */
 }
 
 
@@ -2086,16 +2053,11 @@ static void reflow_lines(GeanyEditor *editor, gint column)
 	start = sci_get_line_from_position(editor->sci,
 		sci_get_selection_start(editor->sci));
 
-	/*
-	 * If several lines are selected, first join them.
-	 * This allows to reformat text paragraphs easily.
-	 */
+	/* if several lines are selected, join them. */
 	if (sci_get_lines_selected(editor->sci) > 1)
 		join_lines(editor);
 
-	/*
-	 * If this line is short enough, just return
-	 */
+	/* if this line is short enough, do nothing */
 	if (column > sci_get_line_end_position(editor->sci, start) -
 		sci_get_position_from_line(editor->sci, start))
 	{
@@ -2118,15 +2080,11 @@ static void reflow_lines(GeanyEditor *editor, gint column)
 	indent = sci_get_line_indentation(editor->sci, start);
 	sci_set_line_indentation(editor->sci, start, 0);
 
-	/*
-	 * Use sci_get_line_count() to determine how many new lines
-	 * appeared during splitting. SCI_LINESSPLIT should better return
-	 * this value itself...
-	 */
 	sci_target_from_selection(editor->sci);
 	linescount = sci_get_line_count(editor->sci);
 	sci_lines_split(editor->sci,
 		(column - indent) *	sci_text_width(editor->sci, STYLE_DEFAULT, " "));
+	/* use lines count to determine how many lines appeared after splitting */
 	linescount = sci_get_line_count(editor->sci) - linescount;
 
 	/* Fix indentation. */



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



More information about the Commits mailing list