SF.net SVN: geany: [1428] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Thu Mar 29 11:12:49 UTC 2007
Revision: 1428
http://svn.sourceforge.net/geany/?rev=1428&view=rev
Author: ntrel
Date: 2007-03-29 04:12:48 -0700 (Thu, 29 Mar 2007)
Log Message:
-----------
Check size of construct completion buffer, remove unneeded static in
sci_cb_auto_forif().
Reorder some of sci_cb_close_block().
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/sci_cb.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-03-28 12:11:37 UTC (rev 1427)
+++ trunk/ChangeLog 2007-03-29 11:12:48 UTC (rev 1428)
@@ -1,3 +1,11 @@
+2007-03-29 Nick Treleaven <nick.treleaven at btinternet.com>
+
+ * src/sci_cb.c:
+ Check size of construct completion buffer, remove unneeded static in
+ sci_cb_auto_forif().
+ Reorder some of sci_cb_close_block().
+
+
2007-03-28 Nick Treleaven <nick.treleaven at btinternet.com>
* src/sci_cb.c:
Modified: trunk/src/sci_cb.c
===================================================================
--- trunk/src/sci_cb.c 2007-03-28 12:11:37 UTC (rev 1427)
+++ trunk/src/sci_cb.c 2007-03-29 11:12:48 UTC (rev 1428)
@@ -527,7 +527,7 @@
void sci_cb_close_block(gint idx, gint pos)
{
gint x = 0, cnt = 0;
- gint start_brace, line, line_start, line_len, eol_char_len;
+ gint start_brace, line, line_len, eol_char_len;
gchar *text, *line_buf;
ScintillaObject *sci;
@@ -538,9 +538,7 @@
if (! lexer_has_braces(sci))
return;
- start_brace = brace_match(sci, pos);
line = sci_get_line_from_position(sci, pos);
- line_start = sci_get_position_from_line(sci, line);
line_len = sci_get_line_length(sci, line);
// set eol_char_len to 0 if on last line, because there is no EOL char
eol_char_len = (line == (SSM(sci, SCI_GETLINECOUNT, 0, 0) - 1)) ? 0 :
@@ -558,10 +556,15 @@
if ((line_len - eol_char_len - 1) != cnt) return;
+ start_brace = brace_match(sci, pos); // same as sci_find_bracematch (Document::BraceMatch)?
+
if (start_brace >= 0)
{
+ gint line_start;
+
get_indent(sci, start_brace, TRUE);
text = g_strconcat(indent, "}", NULL);
+ line_start = sci_get_position_from_line(sci, line);
sci_set_anchor(sci, line_start);
SSM(sci, SCI_REPLACESEL, 0, (sptr_t) text);
g_free(text);
@@ -1105,7 +1108,7 @@
gboolean sci_cb_auto_forif(gint idx, gint pos)
{
gboolean result;
- static gchar buf[16];
+ gchar buf[16];
gchar *eol;
gchar *space;
gint lexer, style;
@@ -1140,10 +1143,12 @@
return FALSE;
sci_get_text_range(sci, pos - 15, pos, buf);
+ if (sizeof(buf) != strlen(buf) + 1)
+ return FALSE; // not enough chars in document
/* check that the chars before the current word are only whitespace (on this line).
* this prevents completion of '} while ' */
- i = MIN(strlen(buf) - 1, 15); // index before \0 char
+ i = 14; // index before \0 char
while (i >= 0 && isalpha(buf[i])) i--; // find pos before keyword
while (i >= 0 && buf[i] != '\n' && buf[i] != '\r') // we want to stay in this line('\n' check)
{
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