SF.net SVN: geany: [1096] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Thu Dec 14 15:49:10 UTC 2006
Revision: 1096
http://svn.sourceforge.net/geany/?rev=1096&view=rev
Author: ntrel
Date: 2006-12-14 07:49:10 -0800 (Thu, 14 Dec 2006)
Log Message:
-----------
Fix adding a multiline comment character after pressing enter on the
last line of a multiline comment.
Remove multiline comment indent after pressing enter on last line.
Prevent invalid memory reads in auto_multiline().
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/sci_cb.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-12-14 12:54:36 UTC (rev 1095)
+++ trunk/ChangeLog 2006-12-14 15:49:10 UTC (rev 1096)
@@ -3,6 +3,11 @@
* src/document.c:
Fix updating the symbol list when a file is saved.
Update C-like typedef keywords when reloading a file.
+ * src/sci_cb.c:
+ Fix adding a multiline comment character after pressing enter on the
+ last line of a multiline comment.
+ Remove multiline comment indent after pressing enter on last line.
+ Prevent invalid memory reads in auto_multiline().
2006-12-13 Frank Lanitz <frank at frank.uvena.de>
Modified: trunk/src/sci_cb.c
===================================================================
--- trunk/src/sci_cb.c 2006-12-14 12:54:36 UTC (rev 1095)
+++ trunk/src/sci_cb.c 2006-12-14 15:49:10 UTC (rev 1096)
@@ -1741,17 +1741,23 @@
gchar *continuation = "*"; // the type of comment, '*' (C/C++/Java), '+' and the others (D)
gchar *whitespace = ""; // to hold whitespace if needed
gchar *result;
+ gint len = strlen(previous_line);
// find and stop at end of multi line comment
- i = strlen(previous_line);
- while (isspace(previous_line[i])) i--;
- if (is_doc_comment_char(previous_line[i - 1], lexer) && previous_line[i] == '/') return;
-
+ i = len - 1;
+ while (i >= 0 && isspace(previous_line[i])) i--;
+ if (i >= 1 && is_doc_comment_char(previous_line[i - 1], lexer) && previous_line[i] == '/')
+ {
+ SSM(sci, SCI_DELETEBACK, 0, 0); // remove whitespace indent
+ g_free(previous_line);
+ return;
+ }
// check whether we are on the second line of multi line comment
i = 0;
- while (isspace(previous_line[i])) i++; // get to start of the line
+ while (i < len && isspace(previous_line[i])) i++; // get to start of the line
- if (previous_line[i] == '/' && is_doc_comment_char(previous_line[i + 1], lexer))
+ if (i + 1 < len &&
+ previous_line[i] == '/' && is_doc_comment_char(previous_line[i + 1], lexer))
{ // we are on the second line of a multi line comment, so we have to insert white space
whitespace = " ";
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list