Mercurial > hg > octave-lojdl
changeset 3901:bd0dc53a5093
[project @ 2002-04-17 16:01:22 by jwe]
author | jwe |
---|---|
date | Wed, 17 Apr 2002 16:01:22 +0000 |
parents | ce8e45b027d0 |
children | 3aa0e187901c |
files | src/ChangeLog src/Makefile.in src/load-save.cc |
diffstat | 3 files changed, 28 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-04-17 John W. Eaton <jwe@bevo.che.wisc.edu> + + * load-save.cc (get_lines_and_columns): Handle CRLF as line + separator in addition to LF. + 2002-04-11 John W. Eaton <jwe@bevo.che.wisc.edu> * load-save.cc (hdf5_ofstream::hdf5_ofstream):
--- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,4 +1,4 @@ -# + # # Makefile for octave's src directory # # John W. Eaton
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -1915,6 +1915,17 @@ size_t beg = buf.find_first_not_of (" \t"); + // If we see a CR as the last character in the buffer, we had a + // CRLF pair as the line separator. Any other CR in the text + // will not be considered as whitespace. + + if (beg != NPOS && buf[beg] == '\r' && beg == buf.length () - 1) + { + // We had a blank line ending with a CRLF. Handle it the + // same as an empty line. + beg = NPOS; + } + int tmp_nc = 0; while (beg != NPOS) @@ -1924,7 +1935,17 @@ size_t end = buf.find_first_of (" \t", beg); if (end != NPOS) - beg = buf.find_first_not_of (" \t", end); + { + beg = buf.find_first_not_of (" \t", end); + + if (buf[beg] == '\r' && beg == buf.length () - 1) + { + // We had a line with trailing spaces and + // ending with a CRLF, so this should look like EOL, + // not a new colum. + break; + } + } else break; }