SF.net SVN: geany:[5581] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Sun Mar 6 17:37:59 UTC 2011
Revision: 5581
http://geany.svn.sourceforge.net/geany/?rev=5581&view=rev
Author: eht16
Date: 2011-03-06 17:37:58 +0000 (Sun, 06 Mar 2011)
Log Message:
-----------
Fix off-by-one bug which hidden the last empty line of a document.
Modified Paths:
--------------
trunk/ChangeLog
trunk/plugins/export.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2011-03-06 17:25:15 UTC (rev 5580)
+++ trunk/ChangeLog 2011-03-06 17:37:58 UTC (rev 5581)
@@ -20,6 +20,7 @@
Add option to insert line numbers (closes #3197150).
Cleanup.
Use the full filename and add the extension of the export format.
+ Fix off-by-one bug which hidden the last empty line of a document.
2011-03-05 Colomban Wendling <colomban(at)geany(dot)org>
Modified: trunk/plugins/export.c
===================================================================
--- trunk/plugins/export.c 2011-03-06 17:25:15 UTC (rev 5580)
+++ trunk/plugins/export.c 2011-03-06 17:37:58 UTC (rev 5581)
@@ -392,7 +392,7 @@
/* read the document and write the LaTeX code */
body = g_string_new("");
doc_len = sci_get_length(sci);
- for (i = 0; i < doc_len; i++)
+ for (i = 0; i <= doc_len; i++)
{
style = sci_get_style_at(sci, i);
c = sci_get_char_at(sci, i);
@@ -421,9 +421,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)
@@ -632,7 +634,7 @@
/* read the document and write the HTML body */
body = g_string_new("");
doc_len = sci_get_length(sci);
- for (i = 0; i < doc_len; i++)
+ for (i = 0; i <= doc_len; i++)
{
style = sci_get_style_at(sci, i);
c = sci_get_char_at(sci, i);
@@ -661,9 +663,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.
More information about the Commits
mailing list