Revision: 5772 http://geany.svn.sourceforge.net/geany/?rev=5772&view=rev Author: eht16 Date: 2011-05-08 17:09:49 +0000 (Sun, 08 May 2011)
Log Message: ----------- Fix off-by-one bug which hidden the last empty line of a document.
Modified Paths: -------------- branches/0.20.1/ChangeLog branches/0.20.1/plugins/export.c
Modified: branches/0.20.1/ChangeLog =================================================================== --- branches/0.20.1/ChangeLog 2011-05-08 17:05:21 UTC (rev 5771) +++ branches/0.20.1/ChangeLog 2011-05-08 17:09:49 UTC (rev 5772) @@ -19,6 +19,8 @@ * plugins/saveactions.c: Fix wrong warning on empty backup directory setting if 'Backup Copy' is not enabled at all. + * plugins/export.c: + Fix off-by-one bug which hidden the last empty line of a document.
2011-01-05 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: branches/0.20.1/plugins/export.c =================================================================== --- branches/0.20.1/plugins/export.c 2011-05-08 17:05:21 UTC (rev 5771) +++ branches/0.20.1/plugins/export.c 2011-05-08 17:09:49 UTC (rev 5772) @@ -354,7 +354,7 @@ /* read the document and write the LaTeX code */ body = g_string_new(""); doc_len = sci_get_length(doc->editor->sci); - for (i = 0; i < doc_len; i++) + for (i = 0; i <= doc_len; i++) { style = sci_get_style_at(doc->editor->sci, i); c = sci_get_char_at(doc->editor->sci, i); @@ -369,9 +369,11 @@ g_string_append(body, "}\n"); block_open = FALSE; } - g_string_append_printf(body, "\style%s{", get_tex_style(style)); - - block_open = TRUE; + if (i < doc_len) + { + g_string_append_printf(body, "\style%s{", get_tex_style(style)); + block_open = TRUE; + } } /* escape the current character if necessary else just add it */ switch (c) @@ -574,7 +576,7 @@ /* read the document and write the HTML body */ body = g_string_new(""); doc_len = sci_get_length(doc->editor->sci); - for (i = 0; i < doc_len; i++) + for (i = 0; i <= doc_len; i++) { style = sci_get_style_at(doc->editor->sci, i); c = sci_get_char_at(doc->editor->sci, i); @@ -589,9 +591,11 @@ { g_string_append(body, "</span>"); } - g_string_append_printf(body, "<span class="style_%d">", style); - - span_open = TRUE; + if (i < doc_len) + { + g_string_append_printf(body, "<span class="style_%d">", style); + span_open = TRUE; + } } /* escape the current character if necessary else just add it */ switch (c)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.