Revision: 1892 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1892&view=re... Author: frlan Date: 2011-01-29 16:41:27 +0000 (Sat, 29 Jan 2011)
Log Message: ----------- Tableconvert: Move replacement code into general section of replacement function
Modified Paths: -------------- trunk/geany-plugins/tableconvert/src/tableconvert.c
Modified: trunk/geany-plugins/tableconvert/src/tableconvert.c =================================================================== --- trunk/geany-plugins/tableconvert/src/tableconvert.c 2011-01-29 16:41:04 UTC (rev 1891) +++ trunk/geany-plugins/tableconvert/src/tableconvert.c 2011-01-29 16:41:27 UTC (rev 1892) @@ -118,13 +118,8 @@ }
g_string_append(replacement_str, "</table>\n"); - - /* Replacing selection with new table */ - replacement = g_string_free(replacement_str, FALSE); - sci_replace_sel(doc->editor->sci, replacement); - g_free(rows); - g_free(replacement); } + else if (doc->file_type->id == GEANY_FILETYPES_LATEX) { guint i; @@ -156,12 +151,6 @@ /* Adding the footer of table */
g_string_append(replacement_str, "\end{tabular}\n"); - - /* Replacing selection with new table */ - replacement = g_string_free(replacement_str, FALSE); - sci_replace_sel(doc->editor->sci, replacement); - g_free(rows); - g_free(replacement); } } else @@ -172,6 +161,16 @@ g_warning(_("Something went went wrong on parsing selection. Aborting")); return; } + + /* The replacement should have been prepared at this point. Let's go + * on and put it into document and replace selection with it. */ + if (replacement_str != NULL) + { + replacement = g_string_free(replacement_str, FALSE); + sci_replace_sel(doc->editor->sci, replacement); + } + g_free(rows); + g_free(replacement); } /* in case of there was no selection we are just doing nothing */ return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.