Permalink
Browse files

Extra empty line in source fragments

In case of a language that does not uses curly brackets to define blocks (such as Fortran) there was a newline character in the variable c and this was written in the "code fragment" buffer and subsequently written to the output resulting in and extra empty line on top. I languages using curly brackets this is later overwritten by the while loop searching for the open curly bracket.
  • Loading branch information...
albert-github committed Dec 7, 2014
1 parent 540f0b6 commit 79b40a437092bccb6589cdb29c0059a4797b771d
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/definition.cpp
@@ -755,6 +755,7 @@ bool readCodeFragment(const char *fileName,
{
while ((c=fgetc(f))!='\n' && c!=EOF) /* skip */;
lineNr++;
if (found && c == '\n') c = '\0';
}
if (!feof(f))
{
@@ -763,7 +764,7 @@ bool readCodeFragment(const char *fileName,
while (lineNr<=endLine && !feof(f) && !found)
{
int pc=0;
while ((c=fgetc(f))!='{' && c!=':' && c!=EOF)
while ((c=fgetc(f))!='{' && c!=':' && c!=EOF) // } so vi matching brackets has no problem
{
//printf("parsing char `%c'\n",c);
if (c=='\n')
@@ -816,7 +817,7 @@ bool readCodeFragment(const char *fileName,
result+=spaces;
}
// copy until end of line
result+=c;
if (c) result+=c;
startLine=lineNr;
if (c==':')
{

0 comments on commit 79b40a4

Please sign in to comment.