Revision: 5259 http://geany.svn.sourceforge.net/geany/?rev=5259&view=rev Author: eht16 Date: 2010-09-26 18:02:36 +0000 (Sun, 26 Sep 2010)
Log Message: ----------- When commenting/uncommenting with single-line comment characters, ignore any end of line characters before evaluating the current line.
Modified Paths: -------------- trunk/ChangeLog trunk/src/editor.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2010-09-23 16:41:29 UTC (rev 5258) +++ trunk/ChangeLog 2010-09-26 18:02:36 UTC (rev 5259) @@ -1,3 +1,10 @@ +2010-09-25 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * src/editor.c: + When commenting/uncommenting with single-line comment characters, + ignore any end of line characters before evaluating the current line. + + 2010-09-23 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/keyfile.c, src/search.c, src/search.h, doc/geany.txt,
Modified: trunk/src/editor.c =================================================================== --- trunk/src/editor.c 2010-09-23 16:41:29 UTC (rev 5258) +++ trunk/src/editor.c 2010-09-26 18:02:36 UTC (rev 5259) @@ -2740,7 +2740,7 @@ * it returns just 1 */ gint editor_do_uncomment(GeanyEditor *editor, gint line, gboolean toggle) { - gint first_line, last_line; + gint first_line, last_line, eol_char_len; gint x, i, line_start, line_len; gint sel_start, sel_end; gint count = 0; @@ -2769,6 +2769,7 @@ }
ft = editor->document->file_type; + eol_char_len = editor_get_eol_char_len(editor);
/* detection of HTML vs PHP code, if non-PHP set filetype to XML */ line_start = sci_get_position_from_line(editor->sci, first_line); @@ -2797,7 +2798,7 @@ line_len = sci_get_line_length(editor->sci, i); x = 0;
- buf_len = MIN((gint)sizeof(sel) - 1, line_len - 1); + buf_len = MIN((gint)sizeof(sel) - 1, line_len - eol_char_len); if (buf_len <= 0) continue; sci_get_text_range(editor->sci, line_start, line_start + buf_len, sel); @@ -2876,7 +2877,7 @@
void editor_do_comment_toggle(GeanyEditor *editor) { - gint first_line, last_line; + gint first_line, last_line, eol_char_len; gint x, i, line_start, line_len, first_line_start; gint sel_start, sel_end; gint count_commented = 0, count_uncommented = 0; @@ -2893,6 +2894,7 @@ sel_end = sci_get_selection_end(editor->sci);
ft = editor->document->file_type; + eol_char_len = editor_get_eol_char_len(editor);
first_line = sci_get_line_from_position(editor->sci, sci_get_selection_start(editor->sci)); @@ -2928,7 +2930,7 @@ line_len = sci_get_line_length(editor->sci, i); x = 0;
- buf_len = MIN((gint)sizeof(sel) - 1, line_len - 1); + buf_len = MIN((gint)sizeof(sel) - 1, line_len - eol_char_len); if (buf_len < 0) continue; sci_get_text_range(editor->sci, line_start, line_start + buf_len, sel); @@ -3036,7 +3038,7 @@ /* set toggle to TRUE if the caller is the toggle function, FALSE otherwise */ void editor_do_comment(GeanyEditor *editor, gint line, gboolean allow_empty_lines, gboolean toggle) { - gint first_line, last_line; + gint first_line, last_line, eol_char_len; gint x, i, line_start, line_len; gint sel_start, sel_end, co_len; gchar sel[256], *co, *cc; @@ -3063,6 +3065,7 @@ }
ft = editor->document->file_type; + eol_char_len = editor_get_eol_char_len(editor);
/* detection of HTML vs PHP code, if non-PHP set filetype to XML */ line_start = sci_get_position_from_line(editor->sci, first_line); @@ -3091,7 +3094,7 @@ line_len = sci_get_line_length(editor->sci, i); x = 0;
- buf_len = MIN((gint)sizeof(sel) - 1, line_len - 1); + buf_len = MIN((gint)sizeof(sel) - 1, line_len - eol_char_len); if (buf_len < 0) continue; sci_get_text_range(editor->sci, line_start, line_start + buf_len, sel);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.