# HG changeset patch # User Rik # Date 1363804999 25200 # Node ID b73b5ab6c277a65bf2e51ed9cd54bcb08cdde068 # Parent c34f8bb1ebece868563f3c89ffca86e31de9a02e Remove extra line printed at end of dbtype (off-by-1 error). * libinterp/interpfcn/debug.cc: Don't print line number at start of line until fs.get () has checked that this is not EOF. diff --git a/libinterp/interpfcn/debug.cc b/libinterp/interpfcn/debug.cc --- a/libinterp/interpfcn/debug.cc +++ b/libinterp/interpfcn/debug.cc @@ -764,13 +764,18 @@ { char ch; int line = 1; - - if (line >= start && line <= end) - os << line << "\t"; + bool isnewline = true; - while (fs.get (ch)) + // FIXME: Why not use line-oriented input here [getline()]? + while (fs.get (ch) && line <= end) { - if (line >= start && line <= end) + if (isnewline && line >= start) + { + os << line << "\t"; + isnewline = false; + } + + if (line >= start) { os << ch; } @@ -778,8 +783,7 @@ if (ch == '\n') { line++; - if (line >= start && line <= end) - os << line << "\t"; + isnewline = true; } } }