Commit 23701448 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Merge pull request #256 from albert-github/feature/bug_first_line_inline

Extra empty line in source fragments
parents 772046d4 79b40a43
...@@ -755,6 +755,7 @@ bool readCodeFragment(const char *fileName, ...@@ -755,6 +755,7 @@ bool readCodeFragment(const char *fileName,
{ {
while ((c=fgetc(f))!='\n' && c!=EOF) /* skip */; while ((c=fgetc(f))!='\n' && c!=EOF) /* skip */;
lineNr++; lineNr++;
if (found && c == '\n') c = '\0';
} }
if (!feof(f)) if (!feof(f))
{ {
...@@ -763,7 +764,7 @@ bool readCodeFragment(const char *fileName, ...@@ -763,7 +764,7 @@ bool readCodeFragment(const char *fileName,
while (lineNr<=endLine && !feof(f) && !found) while (lineNr<=endLine && !feof(f) && !found)
{ {
int pc=0; 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); //printf("parsing char `%c'\n",c);
if (c=='\n') if (c=='\n')
...@@ -816,7 +817,7 @@ bool readCodeFragment(const char *fileName, ...@@ -816,7 +817,7 @@ bool readCodeFragment(const char *fileName,
result+=spaces; result+=spaces;
} }
// copy until end of line // copy until end of line
result+=c; if (c) result+=c;
startLine=lineNr; startLine=lineNr;
if (c==':') if (c==':')
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment