TDB2 parsing
- TDB2::load_lines was splitting the text on \n, but because the last line contains \n, there was an additional blank line. This is what split_minimal is for. - split_minimal contained a copy/paste bug that added the extra line if the input was non-trivial, instead of if the remainder was non- trivial. - Fixed incorrect unit test accordingly.
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//#include <iostream> // TODO Remove.
|
||||
#include <Context.h>
|
||||
#include <text.h>
|
||||
#include <TDB2.h>
|
||||
@@ -287,13 +288,8 @@ void TF2::load_lines ()
|
||||
if (! _loaded_contents)
|
||||
load_contents ();
|
||||
|
||||
split (_lines, _contents, '\n');
|
||||
split_minimal (_lines, _contents, '\n');
|
||||
_loaded_lines = true;
|
||||
|
||||
/*
|
||||
if (_lines.back () == "")
|
||||
_lines.pop_back ();
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user