//Search for all paragraphs and breaks in the line and add them to the v_lines vector.
//Search for all paragraphs and breaks in the line. These two tags mark where a line in the viewer is defined before spliting, so they will be given to the split_line function which will push each segment of the line onto the v_lines vector.
//Check to see if we have a paragraph tag, so we can add a blank line.
//Check to see if we have a paragraph tag, so we know how big the current tag being processed is..
boolis_p=_tag==line.find("<p>");
inttag_len=is_p?3:4;
//Separate out text that should stay in the previous line and text that goes in the new line. Delete the tag in the process.
//Separate out text that should stay in the line to be split and text that goes in the next line. Delete the tag in the process.
std::stringextra_text=line.substr(_tag+tag_len);
line.erase(_tag);
curr_line+=line;
//However, if the tag is located at the start of the file, there will be no data, so it shouldn't be added as it will be an empty line.
//If the tag is located at the start of the file, there will be no data, so it shouldn't be added as it will be an empty line.
if(curr_line!="")
{
split_line(curr_line);
curr_line="";
if(is_p)
//Add a blank line if a paragraph tag was just processed.
if(is_p)
{
v_lines_.push_back("");
}
}
//Move any remaining data on the line back into the line variable so that it can be processed.
//Move any remaining data on the line back into the line variable so that it can be processed in the next line.
line=extra_text;
}
//Add any data that has been unprocessed up to this point.
curr_line+=line;
}
// Push the contents of curr_line as it has the last line in the file.
// The contents of curr_line are the final parts of the last paragraph, so there will be no break or paragraph tags to push it onto the vector. The line is told to be processed here to allow this final content to get added in.
split_line(curr_line);
ix_top_line_=0;
file_name_=new_file_name;
//If we used the open or go command to open a file, we should add this to the history vector.