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(). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1096 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
73f0b49d67
commit
507d6e0e9c
@ -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@frank.uvena.de>
|
||||
|
18
src/sci_cb.c
18
src/sci_cb.c
@ -1741,17 +1741,23 @@ static void auto_multiline(ScintillaObject *sci, gint pos)
|
||||
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 = " ";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user