Mercurial > hg > octave-lyh
changeset 16342:b73b5ab6c277
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.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 20 Mar 2013 11:43:19 -0700 |
parents | c34f8bb1ebec |
children | dda043ccad7c |
files | libinterp/interpfcn/debug.cc |
diffstat | 1 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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; } } }