mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-10 21:03:04 +00:00
fixits: avoid generating empty lines
* src/fixits.c (fixits_run): If erase the content of a line, also erase the following \n. * tests/input.at (Deprecated directives): Update expectations.
This commit is contained in:
15
src/fixits.c
15
src/fixits.c
@@ -161,6 +161,21 @@ fixits_run (void)
|
||||
break;
|
||||
++offset;
|
||||
}
|
||||
/* If erasing the content of a full line, also remove the
|
||||
end-of-line. */
|
||||
if (f->fix[0] == 0 && f->location.start.column == 1)
|
||||
{
|
||||
int c = getc (in);
|
||||
if (c == EOF)
|
||||
break;
|
||||
else if (c == '\n')
|
||||
{
|
||||
++line;
|
||||
offset = 1;
|
||||
}
|
||||
else
|
||||
ungetc (c, in);
|
||||
}
|
||||
}
|
||||
/* Paste the rest of the file. */
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user