Revision: 1292 http://svn.sourceforge.net/geany/?rev=1292&view=rev Author: ntrel Date: 2007-02-16 08:38:23 -0800 (Fri, 16 Feb 2007)
Log Message: ----------- Rename sci_get_line_end_from_position() with line argument, not position. Don't autocomplete for/if constructs when editing an existing line.
Modified Paths: -------------- trunk/ChangeLog trunk/src/document.c trunk/src/sci_cb.c trunk/src/sciwrappers.c trunk/src/sciwrappers.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-02-16 16:34:57 UTC (rev 1291) +++ trunk/ChangeLog 2007-02-16 16:38:23 UTC (rev 1292) @@ -1,3 +1,11 @@ +2007-02-16 Nick Treleaven nick.treleaven@btinternet.com + + * src/sciwrappers.c, src/sciwrappers.h, src/sci_cb.c, src/document.c: + Rename sci_get_line_end_from_position() with line argument, not + position. + Don't autocomplete for/if constructs when editing an existing line. + + 2007-02-15 Enrico Tröger enrico.troeger@uvena.de
* data/filetypes.perl, src/highlighting.c:
Modified: trunk/src/document.c =================================================================== --- trunk/src/document.c 2007-02-16 16:34:57 UTC (rev 1291) +++ trunk/src/document.c 2007-02-16 16:38:23 UTC (rev 1292) @@ -1635,7 +1635,7 @@ for (line = 0; line < max_lines; line++) { gint line_start = sci_get_position_from_line(doc_list[idx].sci, line); - gint line_end = sci_get_line_end_from_position(doc_list[idx].sci, line); + gint line_end = sci_get_line_end_position(doc_list[idx].sci, line); gint i = line_end - 1; gchar ch = sci_get_char_at(doc_list[idx].sci, i);
Modified: trunk/src/sci_cb.c =================================================================== --- trunk/src/sci_cb.c 2007-02-16 16:34:57 UTC (rev 1291) +++ trunk/src/sci_cb.c 2007-02-16 16:38:23 UTC (rev 1292) @@ -902,6 +902,14 @@ }
+static gboolean at_eol(ScintillaObject *sci, gint pos) +{ + gint line = sci_get_line_from_position(sci, pos); + + return (pos == sci_get_line_end_position(sci, line)); +} + + void sci_cb_auto_forif(gint idx, gint pos) { static gchar buf[16]; @@ -910,17 +918,11 @@ gchar *construct; gint lexer, style; gint i; - gint last_pos; gint space_len; ScintillaObject *sci;
if (idx == -1 || ! doc_list[idx].is_valid || doc_list[idx].file_type == NULL) return; - sci = doc_list[idx].sci;
- last_pos = sci_get_length(sci); - lexer = SSM(sci, SCI_GETLEXER, 0, 0); - style = SSM(sci, SCI_GETSTYLEAT, pos - 2, 0); - // only for C, C++, D, Ferite, Java, JavaScript, Perl and PHP if (doc_list[idx].file_type->id != GEANY_FILETYPES_PHP && doc_list[idx].file_type->id != GEANY_FILETYPES_C && @@ -932,6 +934,13 @@ doc_list[idx].file_type->id != GEANY_FILETYPES_FERITE) return;
+ sci = doc_list[idx].sci; + // return if we are editing an existing line (chars on right of cursor) + if (! at_eol(sci, pos)) + return; + + lexer = SSM(sci, SCI_GETLEXER, 0, 0); + style = SSM(sci, SCI_GETSTYLEAT, pos - 2, 0); // return, if we are in a comment if (is_comment(lexer, style)) return;
Modified: trunk/src/sciwrappers.c =================================================================== --- trunk/src/sciwrappers.c 2007-02-16 16:34:57 UTC (rev 1291) +++ trunk/src/sciwrappers.c 2007-02-16 16:38:23 UTC (rev 1292) @@ -416,9 +416,9 @@ }
-gint sci_get_line_end_from_position(ScintillaObject* sci, gint position) +gint sci_get_line_end_position(ScintillaObject* sci, gint line) { - return SSM(sci, SCI_GETLINEENDPOSITION, position, 0); + return SSM(sci, SCI_GETLINEENDPOSITION, line, 0); }
Modified: trunk/src/sciwrappers.h =================================================================== --- trunk/src/sciwrappers.h 2007-02-16 16:34:57 UTC (rev 1291) +++ trunk/src/sciwrappers.h 2007-02-16 16:38:23 UTC (rev 1292) @@ -96,7 +96,7 @@
void sci_set_selection_start (ScintillaObject* sci, gint position); void sci_set_selection_end (ScintillaObject* sci, gint position); -gint sci_get_line_end_from_position (ScintillaObject* sci, gint position); +gint sci_get_line_end_position (ScintillaObject* sci, gint line);
void sci_toggle_fold (ScintillaObject* sci, gint line); gboolean sci_get_line_is_visible (ScintillaObject* sci, gint line);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.