diff options
Diffstat (limited to 'butl/char-scanner.cxx')
-rw-r--r-- | butl/char-scanner.cxx | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/butl/char-scanner.cxx b/butl/char-scanner.cxx index b923aa6..8be7520 100644 --- a/butl/char-scanner.cxx +++ b/butl/char-scanner.cxx @@ -25,6 +25,19 @@ namespace butl if (v == xchar::traits_type::eof ()) eos_ = true; + else if (crlf_ && v == 0x0D) + { + is_.get (); + xchar::int_type v1 (is_.peek ()); + + if (v1 != '\n') + { + unget_ = true; + buf_ = '\n'; + } + + v = '\n'; + } return xchar (v, line, column); } @@ -53,17 +66,6 @@ namespace butl { is_.get (); - if (crlf_ && c == 0x0D) - { - xchar c1 (peek ()); - - if (c1 == '\n') - { - is_.get (); - c = c1; - } - } - if (c == '\n') { line++; |