Revision: 5629 http://geany.svn.sourceforge.net/geany/?rev=5629&view=rev Author: colombanw Date: 2011-03-26 03:12:38 +0000 (Sat, 26 Mar 2011)
Log Message: ----------- Small code cleanups
Modified Paths: -------------- trunk/ChangeLog trunk/src/document.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-03-25 16:49:18 UTC (rev 5628) +++ trunk/ChangeLog 2011-03-26 03:12:38 UTC (rev 5629) @@ -2,6 +2,8 @@
* data/filetypes.vala: Update Vala keywords (based on a patch from Matthew Brush, thanks). + * data/document.c: + Small code cleanups.
2011-03-24 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/document.c =================================================================== --- trunk/src/document.c 2011-03-25 16:49:18 UTC (rev 5628) +++ trunk/src/document.c 2011-03-26 03:12:38 UTC (rev 5629) @@ -980,13 +980,9 @@ c = sci_get_char_at(sci, pos); if (c == '\t') tabs++; - else - if (c == ' ') - { - /* check for at least 2 spaces */ - if (sci_get_char_at(sci, pos + 1) == ' ') - spaces++; - } + /* check for at least 2 spaces */ + else if (c == ' ' && sci_get_char_at(sci, pos + 1) == ' ') + spaces++; } if (spaces == 0 && tabs == 0) return iprefs->type; @@ -1058,25 +1054,6 @@ }
-#if 0 -static gboolean auto_update_tag_list(gpointer data) -{ - GeanyDocument *doc = data; - - if (! doc || ! doc->is_valid || doc->tm_file == NULL) - return FALSE; - - if (gtk_window_get_focus(GTK_WINDOW(main_widgets.window)) != GTK_WIDGET(doc->editor->sci)) - return TRUE; - - if (update_tags_from_buffer(doc)) - sidebar_update_tag_list(doc, TRUE); - - return TRUE; -} -#endif - - /* To open a new file, set doc to NULL; filename should be locale encoded. * To reload a file, set the doc for the document to be reloaded; filename should be NULL. * pos is the cursor position, which can be overridden by --line and --column. @@ -1232,10 +1209,6 @@ g_free(utf8_filename); g_free(locale_filename);
- /* TODO This could be used to automatically update the symbol list, - * based on a configurable interval */ - /*g_timeout_add(10000, auto_update_tag_list, doc);*/ - /* set the cursor position according to pos, cl_options.goto_line and cl_options.goto_column */ pos = set_cursor_position(doc->editor, pos); /* now bring the file in front */ @@ -1261,18 +1234,10 @@ if (length < 0) length = strlen(data);
- switch (utils_get_line_endings(data, length)) - { - case SC_EOL_CR: list = g_strsplit(data, "\r", 0); break; - case SC_EOL_CRLF: list = g_strsplit(data, "\r\n", 0); break; - case SC_EOL_LF: list = g_strsplit(data, "\n", 0); break; - default: list = g_strsplit(data, "\n", 0); - } + list = g_strsplit(data, utils_get_eol_char(utils_get_line_endings(data, length)), 0);
- for (i = 0; ; i++) + for (i = 0; list[i] != NULL; i++) { - if (list[i] == NULL) - break; filename = g_filename_from_uri(list[i], NULL, NULL); if (G_UNLIKELY(filename == NULL)) continue;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.